Hi,
Please use ?dput() for the example data sunrise<- structure(list(day_frac = c("Santiago", "Ourense", "Vigo", "Ferrol", "Santiago", "Ourense", "Vigo", "Ferrol", "Santiago", "Ourense", "Vigo", "Ferrol"), time = structure(c(1372935664, 1372935605, 1372935846, 1372935458, 1373022101, 1373022041, 1373022282, 1373021896, 1373108540, 1373108479, 1373108720, 1373108336), class = c("POSIXct", "POSIXt"), tzone = ""), V3 = c("2013-07-04", "2013-07-04", "2013-07-04", "2013-07-04", "2013-07-05", "2013-07-05", "2013-07-05", "2013-07-05", "2013-07-06", "2013-07-06", "2013-07-06", "2013-07-06")), .Names = c("day_frac", "time", "V3"), row.names = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"), class = "data.frame") library(reshape2) res<-dcast(sunrise,V3~day_frac,value.var="time") res # V3 Ferrol Ourense Santiago #1 2013-07-04 2013-07-04 06:57:38 2013-07-04 07:00:05 2013-07-04 07:01:04 #2 2013-07-05 2013-07-05 06:58:16 2013-07-05 07:00:41 2013-07-05 07:01:41 #3 2013-07-06 2013-07-06 06:58:56 2013-07-06 07:01:19 2013-07-06 07:02:20 # Vigo #1 2013-07-04 07:04:06 #2 2013-07-05 07:04:42 #3 2013-07-06 07:05:20 A.K. ----- Original Message ----- From: Dominic Roye <dominic.r...@gmail.com> To: R help <r-help@r-project.org> Cc: Sent: Tuesday, July 30, 2013 9:41 AM 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@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.