[R] Problem using RMySQL and fCalendar

Yohan Chalabi chalabi at phys.ethz.ch
Thu Mar 5 12:02:13 CET 2009


>>>> "EN" == Elizabeth Nichols <betsy.nichols at plexlogic.com>
>>>> on Thu, 05 Mar 2009 05:45:40 -0500

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

Hi Elizabeth, 

Please note that the new version of 'fCalendar' has been renamed to
'timeDate'

I tried your example with the new timeDate package and it worked fine
for me.

HTH
Yohan



-- 
PhD student
Swiss Federal Institute of Technology
Zurich

www.ethz.ch




More information about the R-help mailing list