Learn R Programming

repfun (version 0.1.2)

ru_expvarlist: Expand SAS Style Variable/Column List

Description

Pass in a data frame along with column/variable identifiers formatted with SAS Style (i.e., using colon) and it will be expanded to the actual variable list.

Usage

ru_expvarlist(dsetin, varsin = NULL, keepnotexist = FALSE)

Value

A list of column/variable names.

Arguments

dsetin

A dataframe holding columns whose names will be expanded.

varsin

A SAS style list of variable names.

keepnotexist

If the variable does not exist on the dataframe it will be excluded from the list.

Examples

Run this code
library(repfun)
df <- data.frame(tt_ac01=c('1','2','3'),
                 tt_ac02=c('a','b','b'),
                 tt_ac03=c('10','11','12'))
chk <- repfun::ru_expvarlist(df, varsin="tt_ac:")
print(chk)

Run the code above in your browser using DataLab