[R] origin and "origin<-" functions on chron

Gabor Grothendieck ggrothendieck at gmail.com
Wed Nov 16 00:33:37 CET 2005


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
>




More information about the R-help mailing list