{
  "name": "Comparison of Base R Indexing and Condition Identification Functions",
  "description": "A comparative analysis of base R indexing, matching, and filtering functions, detailing input requirements, output data structures, missing value behavior, multidimensional array support, and computational paradigms compiled from the official R Core Team base manual pages.",
  "page": "https://casrai.org/guides/which-function-in-r",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-11-16T22:04:44Z",
  "temporalCoverage": null,
  "spatialCoverage": null,
  "columns": [
    {
      "name": "Function Name",
      "unit": "",
      "description": "The base R function or operator evaluated"
    },
    {
      "name": "Primary Input Type",
      "unit": "",
      "description": "Data type and structure accepted as primary input"
    },
    {
      "name": "Output Data Structure",
      "unit": "",
      "description": "Structure and mode of returned object"
    },
    {
      "name": "Missing Value (NA) Handling",
      "unit": "",
      "description": "Treatment of NA values during condition evaluation"
    },
    {
      "name": "Empty Match Output",
      "unit": "",
      "description": "Value returned when zero elements satisfy condition"
    },
    {
      "name": "Multidimensional Support",
      "unit": "",
      "description": "Capability to return array or matrix coordinates"
    },
    {
      "name": "Execution Paradigm",
      "unit": "",
      "description": "Underlying computational strategy and optimization"
    }
  ],
  "rows": [
    {
      "Function Name": "which()",
      "Primary Input Type": "Logical vector or array",
      "Output Data Structure": "Integer vector or coordinate matrix",
      "Missing Value (NA) Handling": "Omitted (treated as FALSE)",
      "Empty Match Output": "integer(0) or 0-row matrix",
      "Multidimensional Support": "Yes (arr.ind = TRUE)",
      "Execution Paradigm": "Eager evaluation / positional extraction"
    },
    {
      "Function Name": "which.min()",
      "Primary Input Type": "Numeric or logical vector",
      "Output Data Structure": "Single integer scalar",
      "Missing Value (NA) Handling": "Omitted (discarded automatically)",
      "Empty Match Output": "integer(0)",
      "Multidimensional Support": "No (flattens dimensions)",
      "Execution Paradigm": "Early termination at first minimum"
    },
    {
      "Function Name": "which.max()",
      "Primary Input Type": "Numeric or logical vector",
      "Output Data Structure": "Single integer scalar",
      "Missing Value (NA) Handling": "Omitted (discarded automatically)",
      "Empty Match Output": "integer(0)",
      "Multidimensional Support": "No (flattens dimensions)",
      "Execution Paradigm": "Early termination at first maximum"
    },
    {
      "Function Name": "match()",
      "Primary Input Type": "Vector of lookup keys and table",
      "Output Data Structure": "Integer vector of positions",
      "Missing Value (NA) Handling": "Matches NA if incomparables = FALSE",
      "Empty Match Output": "nomatch value (default NA_integer_)",
      "Multidimensional Support": "No (1D vectors only)",
      "Execution Paradigm": "Hash table lookup on first match"
    },
    {
      "Function Name": "%in%",
      "Primary Input Type": "Vector of candidate values and set",
      "Output Data Structure": "Logical vector (TRUE/FALSE)",
      "Missing Value (NA) Handling": "Evaluates NA %in% table as boolean",
      "Empty Match Output": "logical(0)",
      "Multidimensional Support": "No (coerced to 1D vector)",
      "Execution Paradigm": "Vectorized wrapper around match() > 0L"
    },
    {
      "Function Name": "subset()",
      "Primary Input Type": "Data frame, matrix, or vector",
      "Output Data Structure": "Filtered object of same class",
      "Missing Value (NA) Handling": "Omitted (drops NA rows like which)",
      "Empty Match Output": "0-row data frame or empty vector",
      "Multidimensional Support": "Yes (2D row and column selection)",
      "Execution Paradigm": "Non-standard evaluation expression"
    }
  ],
  "sources": [
    {
      "title": "R Documentation: which - Which indices are TRUE?",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/base/html/which.html",
      "accessed": "2026-11-16"
    },
    {
      "title": "R Documentation: which.min - Where is the Min() or Max() or first TRUE or FALSE?",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/base/html/which.min.html",
      "accessed": "2026-11-16"
    },
    {
      "title": "R Documentation: match - Value Matching",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/base/html/match.html",
      "accessed": "2026-11-16"
    },
    {
      "title": "R Documentation: subset - Subsetting Vectors, Matrices and Data Frames",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/base/html/subset.html",
      "accessed": "2026-11-16"
    },
    {
      "title": "The R Project for Statistical Computing: An Introduction to R",
      "url": "https://cran.r-project.org/doc/manuals/r-release/R-intro.html",
      "accessed": "2026-11-16"
    }
  ]
}