[R] Reshape

John Kane jrkrideau at inbox.com
Tue Jul 30 17:30:00 CEST 2013


https://github.com/hadley/devtools/wiki/Reproducibility
 http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

John Kane
Kingston ON Canada


> -----Original Message-----
> From: dominic.roye at gmail.com
> Sent: Tue, 30 Jul 2013 15:41:46 +0200
> To: r-help at r-project.org
> Subject: [R] Reshape
> 
> Hello,
> 
> I try out to create a new form from the below data.frame.
> 
> I would like to have this form:
> 
> V3                 Santiago                  Ourense     Vigo    Ferrol
> 2013-07-04     2013-07-04 07:01:04 ......................................
> 
> How can i get this?
> 
>> str(sunrise)
> 'data.frame': 24 obs. of  3 variables:
>  $ day_frac: Factor w/ 4 levels "Ferrol","Ourense",..: 3 2 4 1 3 2 4 1 3
> 2
> ...
>  $ time    : POSIXct, format: "2013-07-04 07:01:04" ...
>  $ V3      : Factor w/ 6 levels "2013-07-04","2013-07-05",..: 1 1 1 1 2 2
> 2
> 2 3 3 ...
> 
>> sunrise
>    day_frac                time         V3
> 1  Santiago 2013-07-04 07:01:04 2013-07-04
> 2   Ourense 2013-07-04 07:00:05 2013-07-04
> 3      Vigo 2013-07-04 07:04:06 2013-07-04
> 4    Ferrol 2013-07-04 06:57:38 2013-07-04
> 5  Santiago 2013-07-05 07:01:41 2013-07-05
> 6   Ourense 2013-07-05 07:00:41 2013-07-05
> 7      Vigo 2013-07-05 07:04:42 2013-07-05
> 8    Ferrol 2013-07-05 06:58:16 2013-07-05
> 9  Santiago 2013-07-06 07:02:20 2013-07-06
> 10  Ourense 2013-07-06 07:01:19 2013-07-06
> 11     Vigo 2013-07-06 07:05:20 2013-07-06
> 12   Ferrol 2013-07-06 06:58:56 2013-07-06
> 
> 
> 
> 
> Thanks,
> 
> Regards
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.

____________________________________________________________
FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!



More information about the R-help mailing list