% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/keepdrop.R
\name{keepdrop}
\alias{keepdrop}
\title{Keep or Drop the variables in the data frame}
\usage{
keepdrop(df, keep = NULL, drop = NULL)
}
\arguments{
\item{df}{The data frame whose variables are to be kept/dropped.}

\item{keep}{A vector consisting of the names of the variables to keep\cr
or sas-like abbreviated list of variables to keep as a string.}

\item{drop}{A vector consisting of the names of the variables to drop\cr
or sas-like abbreviated list of variables to drop as a string.}
}
\value{
A data frame
}
\description{
Keep or Drop the variables in the data frame
}
\details{
This functin first expands the abbreviated variable list by varlst function.
\cr
Then, it creats a data frame with the variables in the keep list. \cr
Finally, it drops those variable in the drop list.
}
\examples{
df <- as.data.frame(demomat(5,7))
names(df) <- c("x1","x2","x3","a","s","m","i")

keepdrop( df, keep=c("x1", "a", "x3") )
keepdrop( df, keep="x1 a x3" )
keepdrop( df, keep="x1-x3 m" )
keepdrop( df, keep="x1--m" )

keepdrop( df, drop=c("x1", "a", "x3") )
keepdrop( df, drop="x1 a x3" )
keepdrop( df, drop="x1-x3 m" )
keepdrop( df, drop="x1--m" )

}
