[R] Reorganize data fram

David Winsemius dwinsemius at comcast.net
Tue Jul 12 16:30:10 CEST 2011


On Jul 12, 2011, at 8:42 AM, anglor wrote:

> Hi,
>
> I have a data frame of about 700 000 rows which look something like  
> this:
>
> Date        Temperature  Category
> 2007102   16                   A
> 2007102   17                   B
> 2007102   18                   C
>
> but need it to be:
>
> Date          TemperatureA  TemperatureB   TemperatureC
> 2007102       16                 17                    18

 > reshape(dat, idvar="Date", timevar="Category", direction="wide")
      Date Temperature.A Temperature.B Temperature.C
1 2007102            16            17            18


>
> Any suggestions?
>
> /Angelica
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Reorganize-data-fram-tp3662123p3662123.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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list