0
votes

I am working on huge data file around millon of entires in excel and the format is something like this: file contain data value at every second for a week

Timevalue ;value

29.07.2015 20:57:20 ; 972.422

29.07.2015 20:57:21 ;972.402

I want to plot the time series for this data. I have tried to use normal plot function and read.csv command but not getting proper result. I also tried zoo package and with zoo i am getting this error

In zoo(rval3, ix) : some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique. I used the unique function on my csv file still getting the same value. Can some guide me how can i solve the task.

(PS: I am new to R)

2

2 Answers

0
votes

This will read in the data averaging rows having the same date/time. Replace text = Lines with something like file = "myfile" :

Lines <- "Timevalue ;value
29.07.2015 20:57:20 ; 972.422
29.07.2015 20:57:21 ;972.402"

library(zoo)
z <- read.zoo(text = Lines, header = TRUE, sep = ";", aggregate = mean,
  format = "%d.%m.%Y %H:%M:%H", tz = "")

plot(z)

Also, note that the message you got was not an error message. It was a warning message.

-1
votes

I would first check if the time column has a time format (like POSIXlt) with str() if it doesn't then convert it with something like this, as.POSIXlt(timesColumn, format = "%d.%m.%Y, %H:%M:%S")

And then you can try to plot it