% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/varlist.R
\name{varlist}
\alias{varlist}
\title{Interprete sas-like abbreviated variable list}
\usage{
varlist(var = NULL, varlistf = NULL, location = 0, regexpr = NULL)
}
\arguments{
\item{var}{string containing sas-like abbreviated variable list such as\cr
     "q5-q7  x1  height--gender"\cr
Comma can be a denominator.}

\item{varlistf}{full list of variables on the basis of which double - is
interpreted. \cr
Use varlistf=colnames(data)\cr
This can be NULL when double - is not used.}

\item{location}{= 1 to output the locatin of var in varlistf \cr
If location == 1, varlistf must be given.}

\item{regexpr}{a string containing a regular expression to be used
to select the variables. \cr
This has priority over var.}
}
\value{
vector or list
}
\description{
Interprete sas-like abbreviated variable list
}
\details{
varlist( "q2-q5 a c--d", varlistf=c("a", "bb","c","d", "e", "gender") ) \cr
will return c( "q2", "q3", "q4", "q5", "a",  "c",  "d" )\cr
  When location == 1, in addition to the vector above, \cr
   the location of the variable names contained in varlistf, if any,
   will be output as the 2nd element of the list, which is\cr
   c(1,3,4)
   \cr
  Expression such as abc: can be used to designate all the variables
  whose names start with abc.
}
\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 )

}
