\Header{reshapeLong}{Reshape data frame to long format}
\keyword{manip}{reshapeLong}
\begin{Description}\relax
(EXPERIMENTAL). Convert data frame with repeated measurements in
wide format with repeated
observations in multiple variables across rows to long
format, 1 row per observation.\end{Description}
\begin{Usage}
\begin{verbatim}
reshapeLong(x, jvars, ilev=row.names(x), jlev=names(x)[jvars],
            iname="reshape.i", jname="reshape.j", vname="reshape.v")
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] The data frame to convert
\item[\code{jvars}] The variables to reshape by
\item[\code{ilev}] Levels of 1st indexing factor
\item[\code{jlev}] Levels of 2nd indexing factor
\item[\code{iname}] Name of 1st indexing factor
\item[\code{jname}] Name of 2nd indexing factor 
\item[\code{vname}] Name of variable holding the combined values of the
"across" variables
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This causes the values in \code{jvars} to be combined into a single
variable, all other variables being replicated the relevant number of
times. Two factors are added to the data frame indicating rows and
columns of the original data format.\end{Details}
\begin{Value}
The reshaped data frame.\end{Value}
\begin{Section}{Bugs}
There ought to be a way to have multiple sets of
\code{jvars} variables.\end{Section}
\begin{Note}\relax
The same substitution tricks are used for \code{jvars} as for the
\code{select} argument to \code{subset}. I.e.\ the argument is treated
as an expression and variables are replaced with their number in the
data frame, allowing ranges of variables to be specified.\end{Note}
\begin{SeeAlso}\relax
\code{\Link{reshapeWide}}, \code{\Link{stack}}\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
(dd<-as.data.frame(matrix(1:24,4)))
reshapeLong(dd,V3:V5)
\end{ExampleCode}
\end{Examples}

