[R] subscripted assignment of grid units

pbarros pbarros at ualg.pt
Tue Jul 7 13:00:13 CEST 2009


Hi,

I want to do subscripted assignment of grid units, but I cannot find a
straightforward way of doing it (and I have searched all forums and places I
could think about, including Paul Murrell,s page). The usual subscripted
assignment operator does replace the numeric part, but does not update the
attributes. Before I write my own function, manipulating attributes etc I
would like to know if such a function already exists (I am sure it does).
What I want to do can be reflected as in the code below:

 testUnit <- unit(1, "lines")
> testUnit
[1] 1lines
> testUnits <- rep(testUnit, 5)
> testUnits
[1] 1lines 1lines 1lines 1lines 1lines
> testUnit2 <- unit(0.5, "grobwidth", textGrob("Testing"))
> testUnits[3] <- testUnit2
> testUnits
[1] 1lines   1lines   0.5lines 1lines   1lines 

I would like to obtain
[1] 1lines   1lines   0.5grobwidth 1lines   1lines 

Any tips?

Thanks,
Pedro
-- 
View this message in context: http://www.nabble.com/subscripted-assignment-of-grid-units-tp24371172p24371172.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list