[R] error with read.zoo, "Error in xy.coords(x, y) : (list) object cannot be coerced to type 'double'

Henry hccoles at lbl.gov
Fri Feb 17 23:51:30 CET 2012



I'm now trying to read.zoo in a rather long txt file with two columns: 
date/time and value in kW e.g. 432.2189
The read.zoo function finally ran without errors but not sure it is correct. 
I took the header off, and put in commas and added a " at the beginning and
" at the end.

z=read.zoo("Kevin-0-comma-ITPower.txt","%m/%d/%Y
%H:%M:%S",header=FALSE,sep=",",index.column=1)

library(zoo)
library(chron)
# 1 minute spline fit
m1 <- times("00:01:00")
g <- seq(trunc(start(z), m1), end(z), by = m1)
na.spline(z, xout = g)
Error in xy.coords(x, y) : 
  (list) object cannot be coerced to type 'double'

What is causing the "double" error. Do I need to specify the types  
something like.... colClasses = c( "character", "double")

Here is a paste of the beginning of the txt file (6510 lines)

"10/11/2011 23:00:06,432.12
10/11/2011 23:02:09,432.42
10/11/2011 23:05:00,432.42
10/11/2011 23:07:10,432.12
10/11/2011 23:10:01,432.12
10/11/2011 23:12:12,432.22
10/11/2011 23:15:00,432.22
...
...
...
10/31/2011 22:55:08,362.57"


--
View this message in context: http://r.789695.n4.nabble.com/error-with-read-zoo-Error-in-xy-coords-x-y-list-object-cannot-be-coerced-to-type-double-tp4398709p4398709.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list