[R] Example(chron) doesn't work

Gabor Grothendieck ggrothendieck at gmail.com
Wed Oct 26 13:24:32 CEST 2011


On Wed, Oct 26, 2011 at 12:21 AM, hchui <helena.chui at flinders.edu.au> wrote:
> Hi, there,
>
> I have a similar problem. The chron example gives NA. dates doesn't work but
> times does.
>
> I would appreciate it if there's a fix for it.
>
> Thanks,
> Helena
>
>> example(chron)
>
> chron> dts <- dates(c("02/27/92", "02/27/92", "01/14/92",
> chron+                "02/28/92", "02/01/92"))
>
> chron> dts
> [1] <NA> <NA> <NA> <NA> <NA>
>
> chron> # [1] 02/27/92 02/27/92 01/14/92 02/28/92 02/01/92
> chron> tms <- times(c("23:03:20", "22:29:56", "01:03:30",
> chron+                "18:21:03", "16:56:26"))
>
> chron> tms
> [1] 23:03:20 22:29:56 01:03:30 18:21:03 16:56:26
>
> chron> # [1] 23:03:20 22:29:56 01:03:30 18:21:03 16:56:26
> chron> x <- chron(dates = dts, times = tms)
>
> chron> x
> [1] (NA NA) (NA NA) (NA NA) (NA NA) (NA NA)
>
> chron> # [1] (02/27/92 23:03:19) (02/27/92 22:29:56) (01/14/92 01:03:30)
> chron> # [4] (02/28/92 18:21:03) (02/01/92 16:56:26)
> chron>
> chron> # We can add or subtract scalars (representing days) to dates or
> chron> # chron objects:
> chron> c(dts[1], dts[1] + 10)
> Error in y + ifelse(m > 2, 0, -1) :
>  non-numeric argument to binary operator
> In addition: Warning message:
> In matrix(unlist(lapply(dots, origin)), nrow = 3) :
>  data length [2] is not a sub-multiple or multiple of the number of rows
> [3]
>> packageDescription("chron")$Version
> [1] "2.3-42"
>> R.version.string
> [1] "R version 2.13.1 (2011-07-08)"
>> win.version()
> [1] "Windows 7 x64 (build 7600)"
>
>


Does it still occur if you start R in vanilla mode?  From Windows console:

Rgui --vanilla

(If you don't have Rgui.exe's directory on your path then cd to the
directory where Rgui.exe is located first.).

Also, does it still occur in the most recent version of R?


-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list