1

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?

B_to_the_ P
  • 109
  • 5
  • 1
    "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?" If that's your assumption, why don't you just plot with `head()`? Did you update all your packages? The error message suggests that you have a problem with package versions – MKR Jul 21 '20 at 07:20
  • 1
    restart R, update grid. Update ggplot2. When knitting you are using a fresh environment, so you would expect different behaviour depending which packages are loaded, which objects you have in your environment etc. – tjebo Jul 21 '20 at 10:35
  • ah, and I'd also update knitr. Bascially, update everything. – tjebo Jul 21 '20 at 10:36
  • All packages are up to date. This is part of an R-project I wasn't involved with. I think the problem is arising from one of the R scripts being `sourced` to within the document, but I haven't pinned it down just yet. – B_to_the_ P Jul 22 '20 at 13:26

0 Answers0