Learn R Programming

epifit (version 0.1.2)

selectVariable: Select variables to keep or drop.

Description

Select variables to keep or drop and a data frame in which variables are kept or dropped is returned.

Usage

selectVariable(data = NULL, keep = NULL, drop = NULL)

Arguments

data
a data frame in which variables are included.
keep
a character vector specifying variables to keep.
drop
a character vector specifying variables to drop.

Value

a data frame in which variables are kept or dropped.

Examples

Run this code
df <- data.frame(id=seq(1,10), str=letters[1:10], fac=factor(seq(1,10)), stringsAsFactors=FALSE)
selectVariable(df, keep=c("id", "str"))
selectVariable(df, drop=c("fac"))

Run the code above in your browser using DataLab