[R] Example(chron) doesn't work

hchui helena.chui at flinders.edu.au
Wed Oct 26 06:21:24 CEST 2011


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)"


--
View this message in context: http://r.789695.n4.nabble.com/Example-chron-doesn-t-work-tp801580p3939363.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list