I am not there yet. I cannot seem to find the package: > install.packages("SHAPE") Warning in install.packages("SHAPE") : argument 'lib' is missing: using 'F:\Users\Kevin\Documents/R/win-library/2.7' Warning message: package ‘SHAPE’ is not available
Is it called something else? Kevin ---- hadley wickham <[EMAIL PROTECTED]> wrote: > On Sat, Aug 2, 2008 at 4:00 PM, hpdutra <[EMAIL PROTECTED]> wrote: > > > > I am sorry but here is an example > >> test > > t1 t2 t3 t4 M F id > > 1 1 0 0 0 1 0 1 > > 2 1 0 0 0 1 0 1 > > 3 1 0 0 0 0 1 1 > > 4 1 0 1 1 1 0 1 > > 5 1 0 1 1 1 0 1 > > 6 1 0 1 1 1 0 1 > > 7 1 0 1 1 0 1 1 > > > >> test<-read.table(h=T, file.choose()) > >> dfm <- melt(test, m = "id") > >> summarised <- cast(dfm, t1+ t2 + t3 + t4 + M + F ~ variable, sum) > >> summarised > > t1 t2 t3 t4 M F id > > 1 1 0 0 0 0 1 1 > > 2 1 0 0 0 1 0 2 > > 3 1 0 1 1 0 1 1 > > 4 1 0 1 1 1 0 3 > > > > > > > > So it works partially because it does not add the male and females columns. > > I am sure it is simple but I just don't know how to do it. I was hoping that > > it would give me the following data > > I think that you need to treat M and F as measured variables as well: > > dfm <- melt(test, m = c("id", "M", "F")) > > Then the same cast command will get you the format that you want. > > Hadley > > -- > http://had.co.nz/ > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.