Learn R Programming

qreport (version 1.0-1)

varType: varType

Description

Determine Types of Variables

Usage

varType(data, include = NULL, exclude = NULL, ndistinct = 10, nnonnum = 20)

Value

list of vectors

Arguments

data

data frame or table to analyze

include

formula or vector of variable names to attend to

exclude

a formula or character vector specifying which variables to exclude from consideration

ndistinct

minimum number of distinct numeric values a variable must have to be considered continuous

nnonnum

maximum number of distinct values a variable can have to be considered discrete

Author

Frank Harrell

Details

For all the variables in a data frame/table, analyzes them to determine types: continuous, nonnumeric, and discrete. include and exclude can be vector or right-side-only formulas.

Examples

Run this code
set.seed(1)
d <- data.frame(i=1:100, x=runif(100), y=sample(1:3, 100, TRUE),
                w=sample(c('cat','dog','giraffe'), 100, TRUE),
                v=sample(letters, 100, TRUE))
varType(d)

Run the code above in your browser using DataLab