davidr@rhotrading.com
2005-Nov-16 14:41 UTC
[R] COM dates (was origin and "origin<-" in chron)
I was just looking for an easy way to convert between COM datetime and chron datetime (both ways.) I found examples on the list, but they involved origin. Does anyone have functions for converting COM datetime <-> chron datetimethat work "safely"? David L. Reiner> -----Original Message-----> From: Gabor Grothendieck [mailto:ggrothendieck@gmail.com]> Sent: Tuesday, November 15, 2005 5:34 PM> To: David Reiner <davidr@rhotrading.com>> Cc: r-help@stat.math.ethz.ch> Subject: [SPAM] - Re: [R] origin and "origin<-" functions on chron -> Bayesian Filter detected spam>> chron has a namespace so try this:>> chron:::origin> getAnywhere("origin<-")>> Having said that I would recommend that you don't use origins inchron.> The situation may have changed but when I wrote the Help Desk article> in R News 4/1 I encountered problems with using origins in some> situations and as discussed in the article its so easy to avoid usingthem> that there is really no good reason I can see not to avoid them.>>> On 11/15/05, davidr@rhotrading.com <davidr@rhotrading.com> wrote:> > I'm trying to use/modify some code I found (at Omegahat, but I'veseem> similar usage elsewhere.)> > It contains the lines:> > if(any(origin(chronDate)!=orig))> > origin(chronDate) <- orig> >> > Let's say:> > > require("chron")> > [1] TRUE> > > chronDate <- chron("11/15/2005", format="m/d/y",> origin.=c(12,31,1899))> > > orig <- c(month=12, day=31, year=1899)> > > origin(chronDate)> > Error: couldn't find function "origin"> > > origin(chronDate) <- orig> > Error: couldn't find function "origin<-"> >> > I'm sure I'm missing something simple here, but what? I've looked inthe> archives and docs quite a lot....> >> > Thanks for the help!> >> > R-2.2.0 on Windows XP (SP2)> >> > > R.Version()> > $platform> > [1] "i386-pc-mingw32"> > $arch> > [1] "i386"> > $os> > [1] "mingw32"> > $system> > [1] "i386, mingw32"> > $status> > [1] ""> > $major> > [1] "2"> > $minor> > [1] "2.0"> > $year> > [1] "2005"> > $month> > [1] "10"> > $day> > [1] "06"> > $"svn rev"> > [1] "35749"> > $language> > [1] "R"> >> > David L. Reiner> >> > Rho Trading> > 440 S. LaSalle St.> > Chicago IL 60605> > 312-362-4963> >> >> > ______________________________________________> > R-help@stat.math.ethz.ch mailing list> > https://stat.ethz.ch/mailman/listinfo/r-help> > PLEASE do read the posting guide! http://www.R-project.org/posting-> guide.html> >David L. Reiner Rho Trading 440 S. LaSalle St. Chicago IL 60605 312-362-4963 [[alternative HTML version deleted]]
Gabor Grothendieck
2005-Nov-16 14:51 UTC
[R] COM dates (was origin and "origin<-" in chron)
This is covered in the R News article. On 11/16/05, davidr at rhotrading.com <davidr at rhotrading.com> wrote:> > > I was just looking for an easy way to convert between COM datetime and chron > datetime (both ways.) > > I found examples on the list, but they involved origin. > > > > Does anyone have functions for converting COM datetime <-> chron > datetimethat work "safely"? > > > > David L. Reiner > > > > > > > -----Original Message----- > > > From: Gabor Grothendieck [mailto:ggrothendieck at gmail.com] > > > Sent: Tuesday, November 15, 2005 5:34 PM > > > To: David Reiner <davidr at rhotrading.com> > > > Cc: r-help at stat.math.ethz.ch > > > Subject: [SPAM] - Re: [R] origin and "origin<-" functions on chron - > > > Bayesian Filter detected spam > > > > > > chron has a namespace so try this: > > > > > > chron:::origin > > > getAnywhere("origin<-") > > > > > > Having said that I would recommend that you don't use origins in chron. > > > The situation may have changed but when I wrote the Help Desk article > > > in R News 4/1 I encountered problems with using origins in some > > > situations and as discussed in the article its so easy to avoid using them > > > that there is really no good reason I can see not to avoid them. > > > > > > > > > On 11/15/05, davidr at rhotrading.com <davidr at rhotrading.com> wrote: > > > > I'm trying to use/modify some code I found (at Omegahat, but I've seem > > > similar usage elsewhere.) > > > > It contains the lines: > > > > if(any(origin(chronDate)!=orig)) > > > > origin(chronDate) <- orig > > > > > > > > Let's say: > > > > > require("chron") > > > > [1] TRUE > > > > > chronDate <- chron("11/15/2005", format="m/d/y", > > > origin.=c(12,31,1899)) > > > > > orig <- c(month=12, day=31, year=1899) > > > > > origin(chronDate) > > > > Error: couldn't find function "origin" > > > > > origin(chronDate) <- orig > > > > Error: couldn't find function "origin<-" > > > > > > > > I'm sure I'm missing something simple here, but what? I've looked in the > > > archives and docs quite a lot.... > > > > > > > > Thanks for the help! > > > > > > > > R-2.2.0 on Windows XP (SP2) > > > > > > > > > R.Version() > > > > $platform > > > > [1] "i386-pc-mingw32" > > > > $arch > > > > [1] "i386" > > > > $os > > > > [1] "mingw32" > > > > $system > > > > [1] "i386, mingw32" > > > > $status > > > > [1] "" > > > > $major > > > > [1] "2" > > > > $minor > > > > [1] "2.0" > > > > $year > > > > [1] "2005" > > > > $month > > > > [1] "10" > > > > $day > > > > [1] "06" > > > > $"svn rev" > > > > [1] "35749" > > > > $language > > > > [1] "R" > > > > > > > > David L. Reiner > > > > > > > > Rho Trading > > > > 440 S. LaSalle St. > > > > Chicago IL 60605 > > > > 312-362-4963 > > > > > > > > > > > > ______________________________________________ > > > > R-help at stat.math.ethz.ch mailing list > > > > https://stat.ethz.ch/mailman/listinfo/r-help > > > > PLEASE do read the posting guide! > http://www.R-project.org/posting- > > > guide.html > > > > > > > > > > David L. Reiner > > > > Rho Trading > > 440 S. LaSalle St. > > Chicago IL 60605 > > 312-362-4963 > > > >
Apparently Analagous Threads
- origin and "origin<-" functions on chron
- can one evaluate an expression in a comment? (or insert resultsinto history?)
- Choices from a matrix
- R 2.1.0 for Windows installation error? atanh not in R.dll?
- Can I find the datetime an object was last assigned to/saved?