Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get unit type from grid graphics unit

Tags:

r

r-grid

In R and the grid package, is there a way to extract the unit type of a unit?

E.g.:

x <- unit(1,'inches')

Is there a function that does:

unittype(x) # returns 'inches'

(Well, I'm sure there is - but what is it?)

cheers.

like image 398
mathematical.coffee Avatar asked Mar 20 '26 07:03

mathematical.coffee


1 Answers

I tend to use attr(x,"unit") but I'm honestly not sure if there is a more pithy function for this.

like image 176
joran Avatar answered Mar 22 '26 23:03

joran



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!