Description Usage Arguments Examples
Get subset of variables in data frame based on type, regexp pattern and specified exclusions.
1 2 3 |
df |
Data frame to be used |
type |
One of "numeric", "factor", "character" or any combination as vector |
pattern |
Regexp pattern used to filter variables |
exclude |
List of variables to be excluded |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # All variable starting with cred
varlist(german_data,pattern="^cred")
# All numeric variable
varlist(german_data,type="numeric")
# All factor variable except variable gb and variables starting with c
varlist(german_data,type="factor",exclude=c("gb",varlist(german_data,pattern="^c")))
# Same as previous, only using pattern instead of c()
varlist(german_data,type="factor",exclude=varlist(german_data,pattern="^c|gb"))
# Everything but factors
varlist(german_data,exclude=varlist(german_data,"factor"))
# Use sapply to apply function for variables
sapply(german_data[,varlist(german_data,type="numeric",pattern="credit")], summary)
sapply(german_data[,varlist(german_data,type="numeric",pattern="credit")],
function (x) length(unique(x)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.