I get the following error using geom_histogram() in ggplot2. Below it is reproduced with standard example data from R, but this seems to happen with any data I provide. I was unable to find explanations and I was unable to debug up through the origin of the error. Any guess? I am using RStudio Version 1.4.1106.
ggplot(diamonds, aes(x=carat)) + geom_histogram(bins=30)
Error in unit(unclass(x), attr(x, "unit"), attr(x, "data")) :
Invalid unit
The error arised from the fact the version of ggplot2 installed was older than the R version (I have to install the packages from a local repository, so sometimes they are not updated). Once I installed the lastest version, it disappeared. Thanks to everyone who investigated the issue.