select_variables: Select variables in a dataframe.

Description Usage Arguments Examples

View source: R/select_variables.r

Description

Select variables in a dataframe.

Usage

1
select_variables(dataframe, cols, weak = TRUE)

Arguments

dataframe

a data.frame

cols

an atomic vector. Drop all but these columns.

weak

logical. Whether or not to add non-existent columns as NAs.

Examples

1
2
3
df <- iris; select_variables(df, 1) # Select only first variable
df <- iris; select_variables(df, c('Sepal.Length', 'Petal.Length'))
df <- iris; select_variables(df, c(TRUE,TRUE,FALSE,FALSE,TRUE)) # Exclude cols 3 and 4

robertzk/syberiaMungebits documentation built on July 30, 2019, 3:37 p.m.