Learn R Programming

epifit (version 0.1.2)

extractVariable: Extract variables according to mode from data.frame.

Description

This function extract variables which match specified mode from data.frame, and make a new data frame.

Usage

extractVariable(data = NULL, mode = "numeric")

Arguments

data
a data.frame from which numeric variables are extracted.
mode
a character specifying object type. Object modes of ‘numeric’, ‘character’, ‘factor’, and ‘logical’ are supported.

Value

a data.frame which includes only specified mode of variables.

Examples

Run this code
df <- data.frame(id=seq(1,10), str=letters[1:10], fac=factor(seq(1,10)), stringsAsFactors=FALSE)
extractVariable(df)
extractVariable(df, mode="character")
extractVariable(df, mode="factor")

Run the code above in your browser using DataLab