Select columns from a data frame. Stop with message if columns do not exist
selectColumns(x, columns = NULL, pattern = NULL, drop = (length(columns) == 1), do.stop = TRUE)
x | data frame |
---|---|
columns | vector of column names. If |
pattern | regular expression matching the names of the columns to be
selected. Will only be evaluated if no explicit column names are given in
|
drop | if |
do.stop | this flag controls whether the function stops ( |
data frame containing the columns of x
that are specified in
columns
or x
itself if columns
is NULL
or a
vector containing the values of column value
if columns
is of
length 1 and drop = TRUE
(which is the default in this case).