[R] xts conversion problem

Nandi nands31 at gmail.com
Thu Nov 12 20:18:14 CET 2009


I have two data frames, with two columns each, the first being a Date
variable. I would like to convert them to xts objects, indexed by the
Date column. I would like to use as.Date and not as.POSIXct as the
dateformat. The puzzling fact is that it works for the first one but
not the other. Here is a screenshot of the error:

> str(DF1)
'data.frame':   367 obs. of  2 variables:
 $ Date:Class 'Date'  num [1:367] 13515 13516 13517 13518 13521 ...
 $ X   : num  28.29 -53.58 58.33 -23.07 9.73 ...
> str(DF2)
'data.frame':   322 obs. of  2 variables:
 $ Date:Class 'Date'  num [1:322] 14061 14062 14063 14067 14068 ...
 $ X   : num  56.9 -16.6 50.1 -17.8 18.6 ...
> DF1.xts <- as.xts(DF1, order.by=as.Date(DF1$Date))
Warning messages:
1: In structure(.Internal(as.POSIXct(x, tz)), class = c("POSIXt",
"POSIXct"),  :
  unknown timezone 'merica/Chicago'
2: In structure(.Internal(as.POSIXct(x, tz)), class = c("POSIXt",
"POSIXct"),  :
  unknown timezone 'merica/Chicago'
3: In structure(.Internal(as.POSIXct(x, tz)), class = c("POSIXt",
"POSIXct"),  :
  unknown timezone 'merica/Chicago'
4: In structure(.Internal(as.POSIXct(x, tz)), class = c("POSIXt",
"POSIXct"),  :
  unknown timezone 'merica/Chicago'
5: In structure(.Internal(as.POSIXct(x, tz)), class = c("POSIXt",
"POSIXct"),  :
  unknown timezone 'merica/Chicago'
> DF2.xts <- as.xts(DF2, order.by=as.Date(DF2$Date))
Error in as.POSIXlt.character(x, tz, ...) :
  character string is not in a standard unambiguous format

I am using R2.10.0, and the latest version of xts (see below). I would
like to understand the cause of this error. I have been experiencing
pretty random errors with the latest version of R & xts. I was
wondering if anyone else is having similar issues. Thanks a lot.

> version
              _
platform       i386-pc-mingw32
arch           i386
os             mingw32
system         i386, mingw32
status
major          2
minor          10.0
year           2009
month          10
day            26
svn rev        50208
language       R
version.string R version 2.10.0 (2009-10-26)
> packageDescription(pkg='xts')
Package: xts
Type: Package
Title: Extensible Time Series
Version: 0.6-9
Date: 2009-10-14
Author: Jeffrey A. Ryan, Josh M. Ulrich
Depends: zoo
Suggests: timeSeries,timeDate,tseries,its,chron,fts,tis
LazyLoad: yes
Maintainer: Jeffrey A. Ryan <jeff.a.ryan at gmail.com>
Description: Provide for uniform handling of R's different time-based
data
        classes by extending zoo, maximizing native format information
        preservation and allowing for user level customization and
        extension, while simplifying cross-class interoperability.
License: GPL-3
URL: http://r-forge.r-project.org/projects/xts/
Repository: R-Forge
Repository/R-Forge/Project: xts
Repository/R-Forge/Revision: 463
Date/Publication: 2009-11-06 17:56:20
Packaged: 2009-11-06 21:12:13 UTC; rforge
Built: R 2.10.0; i386-pc-mingw32; 2009-11-11 00:09:42 UTC; windows

-- File: C:/PROGRA~1/R/R-210~1.0/library/xts/Meta/package.rds




More information about the R-help mailing list