[Rd] A "stack" function
Wed, 29 Mar 2000 08:16:37 -0800 (PST)
On 29 Mar 2000, Douglas Bates wrote:
> I am using R in my undergraduate engineering statistics courses, in
> which I am currently discussing one-way analysis of variance. Many of
> the data sets for the exercises or examples give the data in the form
> on one column per treatment level. To use the aov or lm functions
> such data should be converted to one column with all the response
> observations and a companion column with indicators of the treatment
> In Minitab this operation is called "stacking" columns and the command
> to perform the operation is "stack". I have written a similar function
> for R. Before taking the time to make it elegant and to document it,
> I thought I would check if I have overlooked an existing way of doing
It would be really nice if you could also do the reverse: take repeated
measurements in 'long' form and convert them into 'wide' form.
In Stata both of these are available in the -reshape- command. I don't
know any really simple way of doing it in R.
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: email@example.com