Since moving to R version 4 from 3.6, I've gotten a number of error messages such as the one below when trying to knit my Rmd file. It is always associated with calling a ggplot object created within a script.
Error in identicalUnits(x) :
old version of unit class is no longer allowed
Calls: <Anonymous> ... guide_gengrob.axis -> draw_axis -> unit.c -> identicalUnits
Execution halted
I found the beginnings of an answer in this post but I'm not loading an RDS file. Rather I'm generating the code from a script. What confuses me is that the script run without issue. When I run the individual code chunks in R Markdown, the plot appears. Yet when the document as a whole is knitted, the error is returned.
The code for the plot uses geom_point
. The only other point of note is that the data set is large (>300,000 rows).
Any ideas why this is happening? My first guess is that it is down to the large number of data points and this disrupts the knit. Should I just call on the plot image from file in this instance rather than regenerating?