Skip to content
Prev 35998 / 63424 Next

grid unit bug? (PR#14220)

Paul:

I figured that would be the problem.

I encountered the issue when I tries to check arguments in a validDetails
method for a grob.

Could one substitute the following function in the grid namespace?

is.numeric <- function(x)if(is.unit(x))TRUE else is.numeric(x)

(or make the first clause FALSE)

Obviously, messing around like this might be dangerous -- or at least would
compromise execution speed.

Cheers,
Bert

Bert Gunter
Genentech Nonclinical Biostatistics
 
 

-----Original Message-----
From: paul murrell [mailto:R-bugs at r-project.org] 
Sent: Wednesday, February 24, 2010 4:22 PM
To: gunter.berton at gene.com
Subject: Re: grid unit bug? (PR#14220)
These results simply reflect the underlying data structures (simple "unit"s
are
just numeric vectors, but more complex "unit.arithmetic"s are lists).  I
don't
see how I can "hide" the numeric-ness of simple units (just like there's no
way
to stop a "ts" object like 'Nile' from satisfying is.numeric()).  I could
re-implement simple units as lists, but (apart from the work involved) that
would be (even) less efficient.

1. Is there a situation where this causes a problem?

2. Do you have a possible "fix" in mind?

Paul