[Rd] bug in rep.unit method for grid arithmetic ? (PR#14170)

From: <gunter.berton_at_gene.com>
Date: Tue, 29 Dec 2009 00:05:09 +0100 (CET)


The following code should suffice to document the problem.

Things work properly in the following:

> x <- unit.c(unit(5,"mm"),unit(3,"npc"))
> x

[1] 5mm 3npc
> rep(x,2)

[1] 5mm 3npc 5mm 3npc
> rep(x, e=2)

[1] 5mm 5npc 3mm 3npc
> rep(x,c(2,2))

[1] 5mm 5npc 3mm 3npc

However, not so for:

> x <- x - unit(1,"mm")
> x

[1] 5mm-1mm 3npc-1mm
> rep(x,2)

[1] 5mm-1mm 3npc-1mm 5mm-1mm 3npc-1mm
> rep(x, e=2)

[1] 5mm-1mm 3npc-1mm ##ERROR
> rep(x,c(2,2))

Error in rep(unclass(x), ...) : invalid 'times' argument

> sessionInfo()

R version 2.10.0 (2009-10-26)
i386-pc-mingw32

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C

[5] LC_TIME=English_United States.1252

attached base packages:

 [1] datasets  splines   grid      tcltk     stats     graphics  grDevices
utils     methods   base     

other attached packages:
[1] TinnR_1.0.3     R2HTML_1.59-1   Hmisc_3.7-0     survival_2.35-7
svSocket_0.9-48 lattice_0.17-26 MASS_7.3-3     

loaded via a namespace (and not attached): [1] cluster_1.12.1 svMisc_0.9-56 tools_2.10.0

Best regards and Happy New Year to All,

Bert Gunter
Genentech Nonclinical Biostatistics



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 28 Dec 2009 - 23:08:43 GMT

This archive was generated by hypermail 2.2.0 : Tue 29 Dec 2009 - 09:31:15 GMT