{
  "name": "R Data Merging and Join Methods Comparison Matrix",
  "description": "Systematic comparison of tabular data joining mechanisms across base R, dplyr, data.table, sqldf, and duckdb, documenting syntax, default sorting, key matching rules, and memory behavior compiled from official package documentation and CRAN manuals.",
  "page": "https://casrai.org/guides/merge-function-in-r",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-11-16T22:01:53Z",
  "temporalCoverage": "2024/2026",
  "spatialCoverage": "Global",
  "columns": [
    {
      "name": "Tool / Implementation",
      "unit": "",
      "description": "R package or base environment providing the joining mechanism"
    },
    {
      "name": "Primary Function or Syntax",
      "unit": "",
      "description": "Canonical function call or index syntax used to perform joins"
    },
    {
      "name": "Default Join Type",
      "unit": "",
      "description": "Default relational join operation executed when parameters are omitted"
    },
    {
      "name": "Default Row Ordering",
      "unit": "",
      "description": "Whether the output rows are sorted by key or preserve input order"
    },
    {
      "name": "Duplicate Key Handling",
      "unit": "",
      "description": "How the implementation handles many-to-many key matches"
    },
    {
      "name": "Memory and Indexing Model",
      "unit": "",
      "description": "Underlying data structure and memory handling strategy"
    },
    {
      "name": "Row Capacity Limit",
      "unit": "",
      "description": "Documented row or index size boundaries"
    }
  ],
  "rows": [
    {
      "Tool / Implementation": "Base R (merge.data.frame)",
      "Primary Function or Syntax": "merge(x, y, by = ...)",
      "Default Join Type": "Inner join (natural join)",
      "Default Row Ordering": "Sorted lexicographically by keys (sort = TRUE)",
      "Duplicate Key Handling": "Silent Cartesian product expansion",
      "Memory and Indexing Model": "Copies data frames into RAM vectors",
      "Row Capacity Limit": "Restricted to < 2^31 rows per vector"
    },
    {
      "Tool / Implementation": "tidyverse (dplyr)",
      "Primary Function or Syntax": "left_join(x, y, by = ...)",
      "Default Join Type": "Left outer join (dedicated function per join type)",
      "Default Row Ordering": "Preserves row order of first table (x)",
      "Duplicate Key Handling": "Throws warning unless relationship specified",
      "Memory and Indexing Model": "Altered vector evaluation in RAM",
      "Row Capacity Limit": "Subject to available system RAM"
    },
    {
      "Tool / Implementation": "data.table",
      "Primary Function or Syntax": "x[y, on = .(key)] or merge(x, y)",
      "Default Join Type": "Right join for x[y]; Inner join for merge()",
      "Default Row Ordering": "Preserves key order or row order of second table",
      "Duplicate Key Handling": "Cartesian product with allow.cartesian check",
      "Memory and Indexing Model": "C-level binary search with secondary indexing",
      "Row Capacity Limit": "64-bit integer indexing (> 2^31 rows supported)"
    },
    {
      "Tool / Implementation": "sqldf",
      "Primary Function or Syntax": "sqldf('SELECT * FROM x JOIN y...')",
      "Default Join Type": "Inner join (or explicit SQL JOIN clause)",
      "Default Row Ordering": "Preserves database table order unless ORDER BY used",
      "Duplicate Key Handling": "Standard SQL Cartesian expansion",
      "Memory and Indexing Model": "Copies data frames into embedded SQLite/H2 in RAM",
      "Row Capacity Limit": "Bound by SQLite database and table limits"
    },
    {
      "Tool / Implementation": "DuckDB (duckdb)",
      "Primary Function or Syntax": "dbGetQuery(con, 'SELECT...')",
      "Default Join Type": "Inner join (or explicit SQL JOIN clause)",
      "Default Row Ordering": "Preserves query pipeline order unless ORDER BY used",
      "Duplicate Key Handling": "Standard SQL Cartesian expansion",
      "Memory and Indexing Model": "Vectorized columnar execution engine on disk/RAM",
      "Row Capacity Limit": "Handles out-of-core larger-than-RAM datasets"
    }
  ],
  "sources": [
    {
      "title": "R Core Team: Documentation for merge (merge.data.frame)",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/base/html/merge.html",
      "accessed": "2026-11-13"
    },
    {
      "title": "Posit Software: dplyr Mutating Joins Reference",
      "url": "https://dplyr.tidyverse.org/reference/mutate-joins.html",
      "accessed": "2026-11-13"
    },
    {
      "title": "data.table Development Team: Fast Merge of Two data.tables",
      "url": "https://rdatatable.gitlab.io/data.table/reference/merge.html",
      "accessed": "2026-11-13"
    },
    {
      "title": "CRAN Repository: Package sqldf Specification",
      "url": "https://cran.r-project.org/web/packages/sqldf/index.html",
      "accessed": "2026-11-13"
    }
  ]
}