[R] Sort by timestamp

j.k kathan at gmx.at
Thu Mar 26 08:54:50 CET 2009


#Good morning alltogheter. I'm using R for a short time to analyse TimeSeries
and I have the following Problem:
#I have a bunch of Time Series:
#First of all I import them from a txt File

data.input01 <-read.csv("./LD/20081030.txt", header = TRUE, sep = ";",
quote="\"", dec=",", fill = TRUE, comment.char="")
data.input02 <-read.csv("./LD/20090305.txt", header = TRUE, sep = ";",
quote="\"", dec=",", fill = TRUE, comment.char="")
data.input03 <-read.csv("./LD/20081114.txt", header = TRUE, sep = ";",
quote="\"", dec=",", fill = TRUE, comment.char="")
data.input04 <-read.csv("./LD/20081201.txt", header = TRUE, sep = ";",
quote="\"", dec=",", fill = TRUE, comment.char="")
data.input05 <-read.csv("./LD/20081219.txt", header = TRUE, sep = ";",
quote="\"", dec=",", fill = TRUE, comment.char="")
data.input06 <-read.csv("./LD/20090107.txt", header = TRUE, sep = ";",
quote="\"", dec=",", fill = TRUE, comment.char="")

#After the import they look like that:

                  V1       V2
1  2008-10-14 08:45:00 92130.68
2  2008-10-14 08:50:00 94051.70
3  2008-10-14 08:55:00 97050.85
4  2008-10-14 09:00:00 81133.81
5  2008-10-14 09:05:00 70705.40
6  2008-10-14 09:10:00 75213.92
7  2008-10-14 09:15:00 90876.14
8  2008-10-14 09:20:00 85995.17

#Next steps are to combine them with rbind and sort duplicates out

data.troughput01 <-
rbind(data.input03,data.input01,data.input04,data.input02,data.input05,data.input06)
data.troughput02 <- unique(data.troughput01)

#The Problem is that the dates are mixed and I want to sort/order them by
the date and time.
#The class of the Date/time is as followed:
class(data.input01$V1)
[1] "factor"

# I've already tried sort and order but it didn't work
#Are there any suggestions, how I can solve this issue??

Thanks in advance
Johannes

-- 
View this message in context: http://www.nabble.com/Sort-by-timestamp-tp22717322p22717322.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list