[R] Data Handling

Gabor Grothendieck ggrothendieck at gmail.com
Fri Jul 30 15:27:06 CEST 2010


On Fri, Jul 30, 2010 at 9:02 AM, Lily_stats <sundusc at gmail.com> wrote:
>
> Hi,
>
> I am trying to convert my dataset into xts. I have tried the following :
>
> data1<-read.table("data1.txt",header=F)
> data2<-read.table("data2.txt",header=F)
>
> data1.xts<as.xts(data1,descr="my new xts object)
>
> However, I get an error :
>
> Error in as.POSIXlt.character(x, tz, ...) :
>  character string is not in a standard unambiguous format
>
> I understand that my date and time format might not be accepted and have
> tried to convert this but failed.
>
> Could you suggest something ?
>
> My date is in the format : dd/mm/yyyy
> My time is in the format : hh:00
>
> Thank you in advance
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Data-Handling-tp2307770p2307936.html
> Sent from the R help mailing list archive at Nabble.com.
>

Can't say too much since there is no detail in your post but you can
do something like this:

library(xts) # this also loads zoo
library(chron) # if you wish to use chron
z <- read.zoo(...)
x <- as.xts(z)

where you may need to use FUN= and possibly the index.column= and
other arguments to read.zoo.  See ?read.zoo and the R News 4/1 article
on dates.



More information about the R-help mailing list