[Rd] grid unit bug? (PR#14220)

gunter.berton at gene.com gunter.berton at gene.com
Mon Feb 22 20:30:13 CET 2010


The following seems to me to be at least a perverse trap, if not an =
outright
bug:

> is.numeric(unit(1,"npc"))
[1] TRUE
> is.numeric(1*unit(1,"npc"))
[1] FALSE
> is.numeric(unit(0,"npc") +unit(1,"npc"))
[1] FALSE

...etc.
i.e. is.numeric() appears to be TRUE for class "unit" but false for =
class
("unit.arithmetic" "unit" ). Seems to me it ought to b the same for =
both.


Bert Gunter
Genentech Nonclinical Biostatistics

(FWIW, I think grid graphics is brilliant!)

This was R version 2.11.0dev for Windows btw (not that it makes a
difference):

sessionInfo()

R version 2.11.0 Under development (unstable) (2010-02-15 r51142)=20
i386-pc-mingw32=20

locale:
[1] LC_COLLATE=3DEnglish_United States.1252=20
[2] LC_CTYPE=3DEnglish_United States.1252  =20
[3] LC_MONETARY=3DEnglish_United States.1252
[4] LC_NUMERIC=3DC                         =20
[5] LC_TIME=3DEnglish_United States.1252   =20

attached base packages:
 [1] datasets  splines   grid      tcltk     stats     graphics  =
grDevices
 [8] utils     methods   base    =20

other attached packages:
[1] TinnR_1.0.3     R2HTML_1.59-1   Hmisc_3.7-0     survival_2.35-8
[5] svSocket_0.9-48 lattice_0.18-3  MASS_7.3-5    =20

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



=A0
=A0



More information about the R-devel mailing list