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

From: jim holtman <jholtman_at_gmail.com>
Date: Thu, 21 Feb 2008 12:10:12 -0500

You need to convert to POSIXct since POSIXlt is a vector of size 9. So do the following:

miedate <- as.POSIXct(strptime(as.character(pressione[,1]), format="%d-%m-%Y %H:%M:%S"))

There is a newsletter (I forget the issue) that you might want to refer to on using 'dates'.

On 2/21/08, vittorio <vdemart1_at_tin.it> wrote:
> 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
>
> ______________________________________________
> R-help_at_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.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
R-help_at_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.
Received on Thu 21 Feb 2008 - 17:16:08 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 21 Feb 2008 - 17:30:16 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive