is the culprit and breaks because data[, facet.var[i]] returns a simple features data frame containing two variables, nots and geometry. It makes sense to change the right hand side to pull(data, facet.var[i]) but I'm not sure about the best way to change the underlying class to factor on the left hand side. There are also several other spots in the code where factor(data[, facet.var[i]]) should also use pull().
There seems to be a problem in the
scalebar()
function when the underlying data are simple features and the plot is faceted.Reproducible example:
Throws this error:
It seems that this line in
scalebar()
:is the culprit and breaks because
data[, facet.var[i]]
returns a simple features data frame containing two variables, nots and geometry. It makes sense to change the right hand side topull(data, facet.var[i])
but I'm not sure about the best way to change the underlying class to factor on the left hand side. There are also several other spots in the code wherefactor(data[, facet.var[i]])
should also usepull()
.