I'm trying to pin down a problem with grobWidth applied to gtable objects (see gtable:::widthDetails.gtable); an issue arises when the size is specified as a sum of units (unit.arithmetic object),
library(grid)
u = unit(1,"npc") + unit(2,"mm")
grid:::absolute.units(u)
#Error in UseMethod("absolute.units") :
# no applicable method for 'absolute.units' applied to an object of class #"c('unit.arithmetic', 'unit')"
Remarkably, absolute.size works, even though it calls grid:::absolute.units,
grid::absolute.size(u)
#[1] 1null+2mm
How is that possible?
OK, browsing the grid source code, I found out that the method is defined,
grid:::absolute.units.unit.arithmetic(u)
but it's not exported. So absolute.size() knows about it, because it's in the package namespace, but calling it from outside (e.g. gtable) fails.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With