Hi Everyone,

I am trying to understand the unstack() function but after struggling for
two days, I have given up. More specifically, I am trying the exercises at
the end of  Chapter 1 of Data Analysis and Graphics Using R by Maindonald
and Braun, 2nd ed. Exercise 18 (p. 41) asks to unstack the Rabbit data frame
from the MASS package to get a certain data frame that is shown in the
exercise. Authors suggest to use the unstack() three times but I am so new
to R that I have absolutely no clue as to what is to be done each of those
times. Sadly for me, the help page for unstack() does not give much help
either. For example, the statement in the help page regarding the argument
form, "a two-sided formula whose left side evaluates to the vector to be
unstacked and whose right side evaluates to the indicator of the groups to
create" is very cryptic to me.  Basically, I have tried things like:

unstack(Rabbit, Dose ~ Animal)

but notice that what I get is a data frame in which other columns of the
Rabbit data frame disappear. I would appreciate if someone could help me
understand this function. On page 17 of the same book, there is an example
of unstack() function but that one uses a very simple data frame (only two
columns). I would like to know how to handle more complex data frames as in
the exercise. BTW, this is not a school assignment; I am learning R using
this book on my own. Thanks for any help. Regards,

Tariq

	[[alternative HTML version deleted]]


