[R] A basic question about reshape2

John Kane jrkrideau at yahoo.ca
Sun Mar 13 15:00:36 CET 2011


I am not sure about this but I don't see how a melt command helps.

See what 
z = dcast(x, I ~ V, mean)
gives you.


--- On Sun, 3/13/11, Jim & Carolyn Watkins <jcwatkin at gwi.net> wrote:

> From: Jim & Carolyn Watkins <jcwatkin at gwi.net>
> Subject: [R] A basic question about reshape2
> To: r-help at r-project.org
> Received: Sunday, March 13, 2011, 9:18 AM
> Dear R Community:
> 
>  
> 
> This is a newbie reshare2 question; it starts with read a
> set of data and to
> melt it:
> 
> x = data.frame(I=c("a","b","a","b","b"), V=c(2,4,2,5,7)) 
> 
> y = melt(x, id = 1:1) 
> 
> What is wrong with the final dcast step:
> 
> z = dcast(y, formula = I ~ "variable",  c(length,
> mean, median))

> Will one of you please help me with this problem?






More information about the R-help mailing list