[R] Problem using RMySQL and fCalendar
Elizabeth Nichols
betsy.nichols at plexlogic.com
Thu Mar 5 11:45:40 CET 2009
Hello:
I am trying to use fCalendar for date arithmetic and the RMySQL package
for accessing a MySQL database. The fCalendar math operations seem to
work fine UNTIL I load the RMySQL package. Here is a demonstration:
ean at fibonacci:~/Desktop/amCharts/rsa-metrics$ R
R version 2.7.1 (2008-06-23)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
[Previously saved workspace restored]
> library(fCalendar, pos=2) # For date math
Loading required package: MASS
Loading required package: fUtilities
Rmetrics Package fUtilities (290.76) loaded.
Loading required package: fEcofin
Rmetrics Package fCalendar (270.78.2) loaded.
The new version of 'fCalendar' has been renamed to 'timeDate'
> dt<-"1947-06-13"
> myFC<-"America/NewYork"
> DT<-timeDate(dt, zone=myFC, FinCenter=myFC)
> DT + 3600
America/NewYork
[1] [1947-06-13 01:00:00]
> library(RMySQL, pos=4) # For db access
> DT + 3600
Error in `+.timeDate`(DT, 3600) :
no slot of name "Data" for this object of class "timeDate"
In addition: Warning message:
In `+.timeDate`(DT, 3600) :
trying to get slot "Data" from an object (class "timeDate") that is not
an S4 object
>
As you can see, I can do date arithmetic (DT + 3600) before I load the
RMySQL package but not after. The "pos" arguments to the library()
calls are an unsuccessful attempt to get R to use the Rmetrics fCalendar
package that works instead of whatever gets loaded by RMySQL.
I have Googled until my fingers turned blue and I can't find any useful
information to fix this. Any help would be most appreciated.
Thanks,
eanichols
More information about the R-help
mailing list