[R] Problem with a Matrix

John Kane jrkrideau at inbox.com
Thu Mar 8 16:28:59 CET 2012


I think this is what you want.
library(reshape2)
dcast( xx, Site.No ~ Plant.Name)

John Kane
Kingston ON Canada


> -----Original Message-----
> From: medo_botany at hotmail.com
> Sent: Thu, 8 Mar 2012 01:20:42 -0800 (PST)
> To: r-help at r-project.org
> Subject: [R] Problem with a Matrix
> 
> Dear All,
> 
> I have a problem in making a matrix from a data. I did a summary data
> from a
> big data frame using (ddply), the resulting table is like that:
> 
> Site.No    Plant.Name    Cover.Percentage
> 1                XXX                15
> 1                YYY                 20
> 2                XXX                18
> 2                YYY                 21
> 3                XXX                14
> 3                YYY                 26
> 
> I need to convert it to the following:
> 
>         XXX      YYY
> 1      15        20
> 2      18        21
> 3      14        26
> 
> I tried for the whole day yesterday but I can't solve it. Could you
> please
> help me.
> 
> Thanks in advance for all of you,
> Hamada
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Problem-with-a-Matrix-tp4455954p4455954.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at 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.

____________________________________________________________
Send your photos by email in seconds...
TRY FREE IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if3
Works in all emails, instant messengers, blogs, forums and social networks.



More information about the R-help mailing list