[R] order a data frame after date and hour

anglor angelica.ekenstam at dpes.gu.se
Thu Jul 28 10:05:43 CEST 2011


Hi,

I've got a dataframe looking like this:

                DateHour TcuvInt.A TcuvInt.B TcuvInt.C
1757 2007-03-15 14:00:00                7.83      <NA>
1758 2007-03-15 14:30:00      7.42      7.69      <NA>
1759 2007-03-15 15:00:00      7.53      7.75      <NA>
1760 2007-03-15 15:30:00      7.65      7.73      <NA>


and I need to sort it after the DateHour variable. It is mostly sorted
already except that in the end there is X dates that should be in the
beginning. I tried to find a way to convert the datehour to a number, looked
at format but it didn't work for me. 

Any suggestions?

And also, I'm quite new at R and this forum, someone suggested I use 

df <- data.frame(x = 1:4, y = rnorm(4), z = rpois(4, 3)) 
structure(list(x = 1:4, y = c(-0.24950486967999, 0.151728291232845, 
1.24654200540763, 2.30868457813145), z = c(3, 5, 2, 5)), .Names = c("x", 
"y", "z"), row.names = c(NA, -4L), class = "data.frame")
dput(df) 

for a better display of my problem but I don't understand what this does?

Thank you for help!

Angelica

--
View this message in context: http://r.789695.n4.nabble.com/order-a-data-frame-after-date-and-hour-tp3700721p3700721.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list