{
  "name": "The three R functions named filter: input, NA handling and output",
  "description": "Compares dplyr::filter(), dplyr::filter_out(), base Filter(), base [ indexing and stats::filter() on what they take as input, how they treat NA, and what they return. Compiled from the dplyr reference page and the R manual pages for funprog and stats::filter.",
  "page": "https://casrai.org/guides/filter-function-in-r",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-11-16T21:58:09Z",
  "temporalCoverage": null,
  "spatialCoverage": null,
  "columns": [
    {
      "name": "Function",
      "unit": "",
      "description": ""
    },
    {
      "name": "Package",
      "unit": "",
      "description": ""
    },
    {
      "name": "Input",
      "unit": "",
      "description": ""
    },
    {
      "name": "Treatment of NA",
      "unit": "",
      "description": ""
    },
    {
      "name": "Returns",
      "unit": "",
      "description": ""
    }
  ],
  "rows": [
    {
      "Function": "filter()",
      "Package": "dplyr",
      "Input": "Data frame with logical expressions",
      "Treatment of NA": "Condition NA treated like FALSE: row dropped",
      "Returns": "Rows kept, original order, same type as input"
    },
    {
      "Function": "filter_out()",
      "Package": "dplyr",
      "Input": "Data frame with logical expressions",
      "Treatment of NA": "Condition NA treated like FALSE: row kept",
      "Returns": "Rows not matching, original order, same type as input"
    },
    {
      "Function": "Filter()",
      "Package": "base",
      "Input": "Unary predicate and a vector",
      "Treatment of NA": "NA from predicate always taken as FALSE",
      "Returns": "Subset of the vector where predicate is TRUE"
    },
    {
      "Function": "[ with a logical index",
      "Package": "base",
      "Input": "Vector or data frame with logical index",
      "Treatment of NA": "NA index gives a fully missing row",
      "Returns": "Selected rows including NA rows"
    },
    {
      "Function": "filter() with method convolution or recursive",
      "Package": "stats",
      "Input": "Numeric series and filter coefficients",
      "Treatment of NA": "NA allowed in x, not in the filter coefficients",
      "Returns": "Time-series object, NA at ends unless circular = TRUE"
    }
  ],
  "sources": [
    {
      "title": "dplyr reference: filter()",
      "url": "https://dplyr.tidyverse.org/reference/filter.html",
      "accessed": "2026-11-14"
    },
    {
      "title": "R manual: funprog (Filter, Map, Reduce)",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/base/html/funprog.html",
      "accessed": "2026-11-14"
    },
    {
      "title": "R manual: stats filter",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/stats/html/filter.html",
      "accessed": "2026-11-14"
    }
  ]
}