{
  "name": "na.rm defaults and missing-value behaviour of common R summary functions",
  "description": "Compares, for eight common R functions, whether they have an na.rm argument, its default, and the documented result when NA values are present or the input is empty. Compiled by reading each function's page in the R-devel manual; every cell paraphrases the manual text for that function.",
  "page": "https://casrai.org/guides/rm-na-in-r",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-11-21T08:30:00Z",
  "temporalCoverage": null,
  "spatialCoverage": null,
  "columns": [
    {
      "name": "Function",
      "unit": "",
      "description": ""
    },
    {
      "name": "Signature as documented",
      "unit": "",
      "description": ""
    },
    {
      "name": "na.rm default",
      "unit": "",
      "description": ""
    },
    {
      "name": "Documented behaviour with NA or empty input",
      "unit": "",
      "description": ""
    }
  ],
  "rows": [
    {
      "Function": "mean",
      "Signature as documented": "mean(x, trim = 0, na.rm = FALSE, ...)",
      "na.rm default": "FALSE",
      "Documented behaviour with NA or empty input": "na.rm: should NA values be stripped before the computation proceeds"
    },
    {
      "Function": "sum",
      "Signature as documented": "sum(..., na.rm = FALSE)",
      "na.rm default": "FALSE",
      "Documented behaviour with NA or empty input": "Without na.rm = TRUE any NA or NaN gives NA or NaN; the sum of an empty set is zero"
    },
    {
      "Function": "median",
      "Signature as documented": "median(x, na.rm = FALSE, ...)",
      "na.rm default": "FALSE",
      "Documented behaviour with NA or empty input": "With no values, or NA present and na.rm = FALSE, the result is NA of the same type as x"
    },
    {
      "Function": "max / min",
      "Signature as documented": "max(..., na.rm = FALSE)",
      "na.rm default": "FALSE",
      "Documented behaviour with NA or empty input": "Numeric empty set: max gives -Inf, min gives +Inf; pmax/pmin return NA if all parallel elements are NA even with na.rm = TRUE"
    },
    {
      "Function": "sd",
      "Signature as documented": "sd(x, na.rm = FALSE)",
      "na.rm default": "FALSE",
      "Documented behaviour with NA or empty input": "The standard deviation of a length-one or zero-length vector is NA"
    },
    {
      "Function": "colSums / rowMeans",
      "Signature as documented": "colSums(x, na.rm = FALSE, dims = 1)",
      "na.rm default": "FALSE",
      "Documented behaviour with NA or empty input": "Omission of missing values is done on a per-column or per-row basis"
    },
    {
      "Function": "cor",
      "Signature as documented": "cor(x, y, use = ...)",
      "na.rm default": "No na.rm argument",
      "Documented behaviour with NA or empty input": "Uses use=: everything (default, NA), all.obs (error), complete.obs (casewise deletion), na.or.complete, pairwise.complete.obs"
    }
  ],
  "sources": [
    {
      "title": "R-devel manual: mean",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/base/html/mean.html",
      "accessed": "2026-11-14"
    },
    {
      "title": "R-devel manual: sum",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/base/html/sum.html",
      "accessed": "2026-11-14"
    },
    {
      "title": "R-devel manual: median",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/stats/html/median.html",
      "accessed": "2026-11-14"
    },
    {
      "title": "R-devel manual: Extremes",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/base/html/Extremes.html",
      "accessed": "2026-11-14"
    },
    {
      "title": "R-devel manual: sd",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/stats/html/sd.html",
      "accessed": "2026-11-14"
    },
    {
      "title": "R-devel manual: colSums",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/base/html/colSums.html",
      "accessed": "2026-11-14"
    },
    {
      "title": "R-devel manual: cor",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/stats/html/cor.html",
      "accessed": "2026-11-14"
    }
  ]
}