Hello,
When I run a ggplot I am getting an error message of "Error in identicalUnits(x) : object is not a unit”
I Updated RStudio as well as a few other packages (Tidyverse, Data Tables, more) today and I’m not sure if the error I’m getting is a result of the packages or R Studio.
Plotting worked earlier and previously. When I run the same code on my MacBook Pro (running RStudio 2022.12.0+353) it works without an error. Also if I run the same code in a Quarto document, it plots as expected without generating an error.
Here is my sample dataframe (userpopyear1):
Year Patients
1 2017 1636560
2 2018 1648388
3 2019 1659951
4 2020 1662533
5 2021 1648324
Simple sample plots and the errors from the console:
userpopyear1 %>%
ggplot(aes(x = Year, y = Patients)) +
geom_line()
> userpopyear1 %>%
+ ggplot(aes(x = Year, y = Patients)) +
+ geom_line()
Error in identicalUnits(x) : object is not a unit
userpopyear1 %>%
ggplot(aes(x = Year, y = Patients)) +
geom_bar(stat = "identity”)
> userpopyear1 %>%
+ ggplot(aes(x = Year, y = Patients)) +
+ geom_bar(stat = "identity")
Error in identicalUnits(x) : object is not a unit
I have also tried changing the year to a factor but receive the same error message.
My setup:
MacMini with M1 chip
OSX 13.2.1 (Ventura)
R 4.2.3 GUI 1.79 ARM build
RStudio 2023.02.0+386
Again, this may not be related to RStudio, but I can't figure out why I'm getting this error or what I can do to prevent it.
Any information is appreciated!
Libraries I am using:
library(tidyverse)
library(corrplot)
library(lubridate)
library(data.table)
library(caret)
library(factoextra)
library(scales)
library(broom)
library(ComplexUpset)
library(flextable)
library(reactable)
library(ggrepel)
library(mapboxapi)
library(qdrmapbox)
library(sp)
library(leaflet)
library(leaflegend)
library(patchwork)
library(htmltools)
library(plotly)