{
  "name": "Base R Dimension and Length Inspection Functions Technical Comparison",
  "description": "Technical specification and operational comparison of dimension, row, column, and length inspection functions in base R. Compiled from official R manuals and documentation, comparing return data types, behavior on 1D vectors, support for replacement assignment, and handling of dimension names.",
  "page": "https://casrai.org/guides/dim-in-r",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-11-15T03:43:16Z",
  "temporalCoverage": "2026",
  "spatialCoverage": "Global",
  "columns": [
    {
      "name": "Function Name",
      "unit": "",
      "description": "Base R function identifier"
    },
    {
      "name": "Return on 2D Matrix",
      "unit": "",
      "description": "Output mode and structure when evaluated on a matrix"
    },
    {
      "name": "Behavior on 1D Vector",
      "unit": "",
      "description": "Return value when evaluated on an atomic vector"
    },
    {
      "name": "Behavior on 3D Array",
      "unit": "",
      "description": "Handling of multidimensional tensor arrays"
    },
    {
      "name": "Supports Replacement",
      "unit": "",
      "description": "Whether the function supports '"
    },
    {
      "name": "Effect on Dimnames",
      "unit": "",
      "description": "Impact of function evaluation or assignment on dimension labels"
    }
  ],
  "rows": [
    {
      "Function Name": "dim",
      "Return on 2D Matrix": "Integer vector of length 2: c(nrow, ncol)",
      "Behavior on 1D Vector": "Returns NULL (vectors lack dim attribute)",
      "Behavior on 3D Array": "Returns integer vector of length k",
      "Supports Replacement": "Yes (dim(x)",
      "Effect on Dimnames": "Replacement drops names and dimnames"
    },
    {
      "Function Name": "nrow",
      "Return on 2D Matrix": "Integer scalar of length 1: nrow count",
      "Behavior on 1D Vector": "Returns NULL (no dim attribute present)",
      "Behavior on 3D Array": "Returns extent of first dimension",
      "Supports Replacement": "No (read-only accessor function)",
      "Effect on Dimnames": "No modification to dimension names"
    },
    {
      "Function Name": "ncol",
      "Return on 2D Matrix": "Integer scalar of length 1: ncol count",
      "Behavior on 1D Vector": "Returns NULL (no dim attribute present)",
      "Behavior on 3D Array": "Returns extent of second dimension",
      "Supports Replacement": "No (read-only accessor function)",
      "Effect on Dimnames": "No modification to dimension names"
    },
    {
      "Function Name": "NROW",
      "Return on 2D Matrix": "Integer scalar of length 1: nrow count",
      "Behavior on 1D Vector": "Returns length(x) (treats vector as n x 1)",
      "Behavior on 3D Array": "Returns extent of first dimension",
      "Supports Replacement": "No (read-only accessor function)",
      "Effect on Dimnames": "No modification to dimension names"
    },
    {
      "Function Name": "NCOL",
      "Return on 2D Matrix": "Integer scalar of length 1: ncol count",
      "Behavior on 1D Vector": "Returns 1 (treats vector as n x 1)",
      "Behavior on 3D Array": "Returns extent of second dimension",
      "Supports Replacement": "No (read-only accessor function)",
      "Effect on Dimnames": "No modification to dimension names"
    },
    {
      "Function Name": "length",
      "Return on 2D Matrix": "Integer scalar: total elements (nrow * ncol)",
      "Behavior on 1D Vector": "Returns total element count of vector",
      "Behavior on 3D Array": "Returns total element count across all axes",
      "Supports Replacement": "Yes (length(x)",
      "Effect on Dimnames": "Preserves existing names when truncated"
    },
    {
      "Function Name": "dimnames",
      "Return on 2D Matrix": "List of length 2: list(rownames, colnames)",
      "Behavior on 1D Vector": "Returns NULL (vectors lack dimnames)",
      "Behavior on 3D Array": "Returns list of character vectors of length k",
      "Supports Replacement": "Yes (dimnames(x)",
      "Effect on Dimnames": "Sets or updates dimension label list"
    }
  ],
  "sources": [
    {
      "title": "R Documentation: Dimensions of an Object (base::dim)",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/base/html/dim.html",
      "accessed": "2026-11-14"
    },
    {
      "title": "R Documentation: The Number of Rows/Columns of an Array (base::nrow)",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/base/html/nrow.html",
      "accessed": "2026-11-14"
    },
    {
      "title": "R Documentation: Dimnames of an Object (base::dimnames)",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/base/html/dimnames.html",
      "accessed": "2026-11-14"
    },
    {
      "title": "The R Language Definition: Vector attributes",
      "url": "https://cran.r-project.org/doc/manuals/r-release/R-lang.html",
      "accessed": "2026-11-14"
    }
  ]
}