[R] Problem using RMySQL and fCalendar
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: e...@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 __ R-help@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.
Re: [R] Problem using RMySQL and fCalendar
EN == Elizabeth Nichols betsy.nich...@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 e...@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 __ R-help@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.
Re: [R] Problem using RMySQL and fCalendar
Yohan: First, thanks so much for the virtually instantaneous reponse. I really appreciate it. It seems I now have a different problem. I did an update.packages() and that resulted in getting timeDate package installed. Here is what happens now. Note that as soon as I load RMySQL, I can't print the dateTime object DT. But, I can do math on it and then print the result by turning it into characters. It does seem odd that dt (June 13) converts to DT (June 12th). I assume this has to do with timezones. Perhaps if you tell me exactly where you obtained your RMySQL and timeDate libraries, that would help. I am running Ubuntu (Intrepid). At any rate, this is definitely progress. Again, I appreciate your help. Elizabeth e...@fibonacci:/etc/apt$ 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. library(timeDate) dt-1947-06-13 myFC-America/NewYork DT-timeDate(dt, format=%Y-%m-%d, FinCenter=myFC) DT America/NewYork [1] [1947-06-12 20:00:00] DT + 3600*24 America/NewYork [1] [1947-06-13 20:00:00] library(RMySQL) # For db access DT Error in function (object, ...) : Invalid generic function in 'usemethod' foo-DT + 3600*24 foo Error in function (object, ...) : Invalid generic function in 'usemethod' as.character(foo) [1] 1947-06-13 20:00:00 Yohan Chalabi wrote: EN == Elizabeth Nichols betsy.nich...@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 e...@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 __ R-help@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.