Is the a daylight saving time problem? Check your timezone and see when it occurred; these times might not be legal.
Sent from my iPad On May 16, 2012, at 3:27, Benedikt Gehr <benedikt.g...@ieu.uzh.ch> wrote: > Hi > > I have a rather large data frame (>7000 rows with 28 columns) which I want > to sort by date. Below I have a example of the data frame. The Date column > is called DT, is a factor and looks like this: > > class(res.merge$DT) > [1] "factor" > head(res.merge$DT) > [1] 17.3.2012 13:54:02 17.3.2012 14:00:07 17.3.2012 14:30:25 17.3.2012 > 15:01:15 > [5] 17.3.2012 15:32:14 17.3.2012 16:01:29 > 2530 Levels: 1.4.2012 00:00:52 1.4.2012 00:30:29 ... 9.5.2012 15:30:50 > > res.merge is the data frame unordered. Now I want to order the data frame > with: > > res.ordered<-res.merge[order(as.POSIXct(as.character(res.merge$DT),format="%d.%m.%Y > %H:%M:%S")),] > > This works in fact, however for some reason there are always two entires > that go at the end of the data frame for no obvious reason (see below, > 09.05.2012 ist the most recent date). And this is the case for different > data.frames. The two entries at the end are always 25.3.2012 02:00:xx and > 25.3.2012 02.30.xx. > > Can anybody tell me what the problem is? Any help is most appreciated. > > Best Benedikt > > res.ordered[2545:2549,] > DT Typ NOD Day_s DOW_s Time_s Long Lat > 2547 9.5.2012 14:30:56 GPS 1893 9.5.2012 We 14:30:00 7.452218 46.43579 > 2548 9.5.2012 15:02:09 GPS 1893 9.5.2012 We 15:00:35 7.451983 46.43583 > 2549 9.5.2012 15:30:50 GPS 1893 9.5.2012 We 15:30:00 7.451973 46.43597 > 1845 25.3.2012 02:00:18 GPS 1848 25.3.2012 So 02:00:01 7.454266 46.45414 > 1846 25.3.2012 02:30:16 GPS 1848 25.3.2012 So 02:30:00 7.454413 46.45437 > Height TOF Status FO_GPS GPS_N AOT Day_e DOW_e Time_e BV Temp > SOG > 2547 1182.8 3 A 1 143 55 9.5.2012 We 14:30:56 3735 31 > 0.09 > 2548 1182.8 3 A 1 143 94 9.5.2012 We 15:02:09 3637 32 > 0.02 > 2549 1176.5 3 A 1 143 50 9.5.2012 We 15:30:50 3730 29 > 0.17 > 1845 1295.2 3 A 1 151 17 25.3.2012 So 02:00:18 3715 7 > 0.18 > 1846 1287.3 3 A 1 144 16 25.3.2012 So 02:30:16 3720 8 > 0.14 > Heading SAE HAE BW_2 BW_3 X.. > 2547 24.90 3.81 9.47 3666 3625 9.08 > 2548 7.86 0.51 7.17 3593 3586 9.11 > 2549 344.72 2.86 4.10 3662 3623 9.12 > 1845 335.54 3.53 5.63 3618 3618 0.81 > 1846 75.37 5.44 8.96 3618 3618 0.81 > > -- > View this message in context: > http://r.789695.n4.nabble.com/order-a-data-frame-by-date-with-order-tp4630225.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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.