vartype {lazy.tools}R Documentation

Find the mode/typeof of the columns of data

Description

Find the mode/typeof of the columns of data

Usage

vartype(data, typeof = 0)

Arguments

data

a data frame to be checked.

typeof

= 1 to return typeof(var) instead of mode(var)

Details

mode -> "numeric", "character", etc
typeof -> "integer", "double", "character", etc

When data contains factors, "factor" will be returned for those varaibles.

Value

a vector consisting of typeof or mode.

Examples

 df=data.frame(a=1,b="a",c=as.factor(1), stringsAsFactors=0)
 vartype(df)
 vartype(df, typeof=1)
 ls=list(a=1:2,b=2:4,c=c("a","b"),A=diag(2))
 vartype(ls)
 vartype(ls, typeof=1)


[Package lazy.tools version 0.1.4 ]