Learn R Programming

crunch (version 1.25.0)

dataset-extract: Subset datasets and extract variables

Description

Subset datasets and extract variables

Usage

# S4 method for CrunchDataset,ANY,ANY
[(x, i, j, ..., drop = TRUE)

# S4 method for CrunchDataset,logical,missing [(x, i, j, ..., drop = FALSE)

# S4 method for CrunchDataset,character,ANY [(x, i, j, ..., drop = TRUE)

# S4 method for CrunchDataset,VariableGroup,ANY [(x, i, j, ..., drop = TRUE)

# S4 method for CrunchDataset,VariableOrder,ANY [(x, i, j, ..., drop = TRUE)

# S4 method for CrunchDataset,missing,ANY [(x, i, j, ..., drop = FALSE)

# S4 method for CrunchDataset,CrunchLogicalExpr,missing [(x, i, j, ..., drop = FALSE)

# S4 method for CrunchDataset,CrunchLogicalExpr,ANY [(x, i, j, ..., drop = FALSE)

# S4 method for CrunchDataset subset(x, ...)

# S4 method for CrunchDataset,ANY [[(x, i, ..., drop = FALSE)

# S4 method for CrunchDataset,character [[(x, i, ..., drop = FALSE)

# S4 method for CrunchDataset $(x, name)

Arguments

x

a CrunchDataset

i

As with a data.frame, there are two cases:

  1. if no other arguments are supplied (i.e x[i], i provides for as.list extraction: columns of the dataset rather than rows. If character, identifies variables to extract based on their aliases (by default: set options(crunch.namekey.dataset="name") to use variable names); if numeric or logical, extracts variables accordingly.

  2. If j is specified as either x[i, j] or x[i,]), i is an object of class CrunchLogicalExpr that will define a subset of rows.

j

columnar extraction, as described above

...

additional arguments

drop

logical: automatically simplify a 1-column Dataset to a Variable? Default is FALSE, and the TRUE option is in fact not implemented.

name

columnar extraction for $

Value

[ yields a Dataset; [[ and $ return a Variable