{
  "name": "R Matrix Constructor Functions: Specifications, Classes, and Memory Models",
  "description": "Original compilation comparing matrix constructor functions across base R and the Matrix package, detailing input requirements, storage layout, output classes, and memory format, compiled from official R manuals and CRAN documentation.",
  "page": "https://casrai.org/guides/create-a-matrix-in-r",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-11-16T22:02:27Z",
  "temporalCoverage": null,
  "spatialCoverage": null,
  "columns": [
    {
      "name": "Constructor Function",
      "unit": "",
      "description": "Name of the matrix construction function"
    },
    {
      "name": "Source Package",
      "unit": "",
      "description": "R package providing the constructor function"
    },
    {
      "name": "Primary Input",
      "unit": "",
      "description": "Primary input data structure required"
    },
    {
      "name": "Default Storage Layout",
      "unit": "",
      "description": "Default ordering of data elements in memory"
    },
    {
      "name": "Output Object Class",
      "unit": "",
      "description": "R class attribute of the returned matrix"
    },
    {
      "name": "Memory Architecture",
      "unit": "",
      "description": "Underlying storage mechanism"
    },
    {
      "name": "Sparse Matrix Support",
      "unit": "",
      "description": "Whether sparse compressed representation is supported"
    }
  ],
  "rows": [
    {
      "Constructor Function": "matrix",
      "Source Package": "base",
      "Primary Input": "Atomic vector",
      "Default Storage Layout": "Column-major (byrow=FALSE)",
      "Output Object Class": "matrix, array",
      "Memory Architecture": "Dense contiguous vector",
      "Sparse Matrix Support": "No"
    },
    {
      "Constructor Function": "as.matrix",
      "Source Package": "base",
      "Primary Input": "Data frame, list, or vector",
      "Default Storage Layout": "Column-major",
      "Output Object Class": "matrix, array",
      "Memory Architecture": "Dense contiguous vector",
      "Sparse Matrix Support": "No"
    },
    {
      "Constructor Function": "diag",
      "Source Package": "base",
      "Primary Input": "Scalar dimension or diagonal vector",
      "Default Storage Layout": "Diagonal elements",
      "Output Object Class": "matrix, array",
      "Memory Architecture": "Dense square matrix",
      "Sparse Matrix Support": "No"
    },
    {
      "Constructor Function": "cbind / rbind",
      "Source Package": "base",
      "Primary Input": "Vectors or matrices",
      "Default Storage Layout": "Column or row binding",
      "Output Object Class": "matrix, array",
      "Memory Architecture": "Dense contiguous vector",
      "Sparse Matrix Support": "No"
    },
    {
      "Constructor Function": "Matrix",
      "Source Package": "Matrix",
      "Primary Input": "Vector or matrix",
      "Default Storage Layout": "Column-major",
      "Output Object Class": "dgeMatrix or dgCMatrix",
      "Memory Architecture": "Dense S4 or compressed sparse S4",
      "Sparse Matrix Support": "Yes"
    },
    {
      "Constructor Function": "sparseMatrix",
      "Source Package": "Matrix",
      "Primary Input": "Coordinate triplets (i, j, x)",
      "Default Storage Layout": "Compressed column",
      "Output Object Class": "dgCMatrix",
      "Memory Architecture": "Compressed sparse column (CSC)",
      "Sparse Matrix Support": "Yes"
    }
  ],
  "sources": [
    {
      "title": "R Documentation: matrix (Base Package)",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/base/html/matrix.html",
      "accessed": "2026-11-14"
    },
    {
      "title": "An Introduction to R: Chapter 5 Arrays and matrices",
      "url": "https://cran.r-project.org/doc/manuals/r-release/R-intro.html#Arrays-and-matrices",
      "accessed": "2026-11-14"
    },
    {
      "title": "Matrix: Sparse and Dense Matrix Classes and Methods (CRAN)",
      "url": "https://cran.r-project.org/package=Matrix",
      "accessed": "2026-11-14"
    }
  ]
}