[R] Unable to create/index a zoo irregular timeseries

vittorio vdemart1 at tin.it
Thu Feb 21 17:11:57 CET 2008


In the text file pressione2008.csv I have the following 

"Data","MAX","MIN","Note"
"07-01-2008 08:00:00", 135, 90, "Eccessi feste, inizio dieta"
"07-01-2008 18:00:00", 135, 85, ""
"08-01-2008 08:00:00", 125, 75, ""

which is a collection of blood pressure data at different time of the day. 
I would like to build an its with MIN & MAX blood pressure but being a real 
newbye with zoo I obtain the following

> library(zoo)
pressione <- data.frame(read.csv("pressione2008.csv"))
 
 miedate <- strptime(as.character(pressione[,1]), format="%d-%m-%Y %H:%M:%S")
 
> miedate
[1] "2008-01-07 08:00:00" "2008-01-07 18:00:00" "2008-01-08 08:00:00"

> str(miedate)
 POSIXlt[1:9], format: "2008-01-07 08:00:00" "2008-01-07 18:00:00" ...

> ts<- as.zoo(matrix(pressione[,2:3],ncol=2), miedate)
> ts
Error in Ops.POSIXt(freq, d) : * not defined for "POSIXt" objects

> ts<- zoo(matrix(pressione[,2:3],ncol=2), miedate)
Error in order(x, ..., na.last = na.last, decreasing = decreasing) : 
  unimplemented type 'list' in 'orderVector1'
In addition: Warning message:
In zoo(matrix(pressione[, 2:3], ncol = 2), miedate) :
  some methods for "zoo" objects do not work if the index entries 
in 'order.by' are not unique

> 

Please help

Ciao
Vittorio



More information about the R-help mailing list