Skip to content
Prev 179352 / 398506 Next

re shape package - use one cast() instead of many

Thanks for your help! I wasn't sure what the margins variable did, but I'm
beginning to understand. I'm almost there, but with my data (and with ff_d)
I tried to margin over two variable names, however it only does one of them.
So with ff_d I set margins=c("treatment","variable"); however I only ever
get 1_(all) 2_(all) and 3_(all)... never something like (all)_painty. (This
also happens for margins=TRUE)

To further exemplify, with my data I have the call to cast() as:
cast(data.melted,Subject~CogStat+Animacy,mean,margins=c("CogStat","Animacy"))

which results in:

  Subject     COG_a    COG_i COG_(all)    nCOG_a    nCOG_i nCOG_(all)
1     100  794.3333 676.5556  728.0833  810.7778  798.4103   800.7292
...

I would like additionally to get (all)_i (all)_a. It seems to just apply the
margin to the first part of the formula before "+" (i.e. I can change it to
Animacy+CogStat and get a_COG,    a_nCOG,   a_(all), etc.)
hadley wrote: