[R] as.xts

arun smartpink111 at yahoo.com
Wed Oct 17 21:56:44 CEST 2012


Hi,
If you want to convert reportDate to date format,
Try this:
dat1<-read.table(text="
reportDate    total
1 2010-12-31 170609.2
2 2011-01-03 170778.0
3 2011-01-04 170748.4
4 2011-01-05 170599.5
5 2011-01-06 170335.0
6 2011-01-07 169842.1
",sep="",header=TRUE,stringsAsFactors=FALSE)

 dat1$reportDate<-as.Date(dat1$reportDate,format="%Y-%m-%d")
 str(dat1)
#'data.frame':    6 obs. of  2 variables:
# $ reportDate: Date, format: "2010-12-31" "2011-01-03" ...
# $ total     : num  170609 170778 170748 170600 170335 ...
A.K.




----- Original Message -----
From: sf631 <chad.gray at gmail.com>
To: r-help at r-project.org
Cc: 
Sent: Wednesday, October 17, 2012 3:15 PM
Subject: Re: [R] as.xts

I'm not the original poster, but I do have the same question.  

I have pulled in data via RODBC into a data frame, which looks like below
and I'm getting the same error message: 
/("Error in as.POSIXlt.character(x, tz, ...) : 
  character string is not in a standard unambiguous format")
/

The date format seems pretty straightforward to me so I'm kind of stuck at
what to do.  BTW, I'm *very* new to R so please forgive some ignorance here

reportDate    total
1 2010-12-31 170609.2
2 2011-01-03 170778.0
3 2011-01-04 170748.4
4 2011-01-05 170599.5
5 2011-01-06 170335.0
6 2011-01-07 169842.1





--
View this message in context: http://r.789695.n4.nabble.com/as-xts-tp3028280p4646499.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.





More information about the R-help mailing list