Error: could not find function "unit"
Solution 1:
This is closely related to, although not exactly identical to, arrow() in ggplot2 no longer supported , which says:
[the]
grid
[package] was loaded automatically by previous versions ofggplot[2]
(makinggrid
functions visible/accessible to the user); now it's referred to viaNAMESPACE
imports instead, so you need to explicitly loadgrid
if you want to usegrid
functions (or [to] look at their help pages).
"explicitly load" here means library("grid")
or require("grid")
(grid
is a base package, so doesn't need to be installed separately).
unit()
is a function from the grid
package, so the answer above (which was about arrow()
) applies.
Alternatively you can specify grid::unit(...)
or grid::arrow(...)
without explicitly loading the entire package.