varlist {lazy.tools} | R Documentation |
Interprete sas-like abbreviated variable list
Description
Interprete sas-like abbreviated variable list
Usage
varlist(var = NULL, varlistf = NULL, location = 0, regexpr = NULL)
Arguments
var |
string containing sas-like abbreviated variable list such as |
varlistf |
full list of variables on the basis of which double - is
interpreted. |
location |
= 1 to output the locatin of var in varlistf |
regexpr |
a string containing a regular expression to be used
to select the variables. |
Details
varlist( "q2-q5 a cd", varlistf=c("a", "bb","c","d", "e", "gender") )
will return c( "q2", "q3", "q4", "q5", "a", "c", "d" )
When location == 1, in addition to the vector above,
the location of the variable names contained in varlistf, if any,
will be output as the 2nd element of the list, which is
c(1,3,4)
Expression such as abc: can be used to designate all the variables
whose names start with abc.
Value
vector or list
Examples
varlist( "x3-x1, y5, x8-x9" )
varlistf=c("a", "b","c","d", "e", paste("Q", 1:5, sep=""), "fff" )
varlist( "q2-q5 a e--c", varlistf=varlistf )
varlist( "q2-q5 a e--c Q:", varlistf=varlistf )
varlist( regexpr="^Q[123]", varlistf=varlistf )