{
  "name": "Functions for a correlation matrix in R: inputs, outputs and missing-data handling",
  "description": "Compares four R functions (cor, rcorr, cor.test, cor.mtest) on input type, whether they return a matrix, P-value and confidence-interval output, missing-data handling and methods, compiled from the official R, Hmisc and corrplot documentation.",
  "page": "https://casrai.org/guides/correlation-matrix-in-r",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-11-12T13:55:20Z",
  "temporalCoverage": null,
  "spatialCoverage": null,
  "columns": [
    {
      "name": "Function",
      "unit": "",
      "description": ""
    },
    {
      "name": "Package",
      "unit": "",
      "description": ""
    },
    {
      "name": "Input",
      "unit": "",
      "description": ""
    },
    {
      "name": "Returns a matrix",
      "unit": "",
      "description": ""
    },
    {
      "name": "P-values",
      "unit": "",
      "description": ""
    },
    {
      "name": "Confidence interval",
      "unit": "",
      "description": ""
    },
    {
      "name": "Missing-data handling",
      "unit": "",
      "description": ""
    },
    {
      "name": "Methods",
      "unit": "",
      "description": ""
    }
  ],
  "rows": [
    {
      "Function": "cor()",
      "Package": "stats (base R)",
      "Input": "numeric vector, matrix or data frame; optional y",
      "Returns a matrix": "Yes: correlations between columns of x (and y)",
      "P-values": "No",
      "Confidence interval": "Not provided",
      "Missing-data handling": "use= (everything, all.obs, complete.obs, na.or.complete, pairwise.complete.obs)",
      "Methods": "pearson, kendall, spearman"
    },
    {
      "Function": "rcorr()",
      "Package": "Hmisc (CRAN)",
      "Input": "numeric matrix, at least 5 rows and 2 columns",
      "Returns a matrix": "Yes: r, n, P",
      "P-values": "Yes (P)",
      "Confidence interval": "Not provided",
      "Missing-data handling": "Pairwise deletion",
      "Methods": "pearson, spearman"
    },
    {
      "Function": "cor.test()",
      "Package": "stats (base R)",
      "Input": "two variables (x, y) or formula ~ u + v",
      "Returns a matrix": "No: one pair only",
      "P-values": "Yes",
      "Confidence interval": "Yes (Pearson only, needs at least 4 complete pairs)",
      "Missing-data handling": "Not stated as a matrix option",
      "Methods": "pearson, kendall, spearman"
    },
    {
      "Function": "cor.mtest()",
      "Package": "corrplot (CRAN)",
      "Input": "matrix with samples in rows and features in columns",
      "Returns a matrix": "Yes: p, lowCI, uppCI",
      "P-values": "Yes (p)",
      "Confidence interval": "Yes (lowCI, uppCI)",
      "Missing-data handling": "Arguments passed on to cor.test()",
      "Methods": "As passed to cor.test()"
    }
  ],
  "sources": [
    {
      "title": "R stats: cor",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/stats/html/cor.html",
      "accessed": "2026-11-12"
    },
    {
      "title": "R stats: cor.test",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/stats/html/cor.test.html",
      "accessed": "2026-11-12"
    },
    {
      "title": "Hmisc rcorr",
      "url": "https://rdrr.io/cran/Hmisc/man/rcorr.html",
      "accessed": "2026-11-12"
    },
    {
      "title": "corrplot cor.mtest",
      "url": "https://rdrr.io/cran/corrplot/man/cor.mtest.html",
      "accessed": "2026-11-12"
    }
  ]
}