Displaying 1 result from an estimated 1 matches for "check_aesthetics".
2023 Jan 12
1
Reg: ggplot error
...= "ICUData.csv", stringsAsFactors = TRUE)
ICUData.neuro <- ICUData[ICUData$surgery == "neuro",]
2. ggplot(ICUData, aes(x=ICUData.neuro$LOS)) +
geom_histogram(aes(y=after_stat(density)), binwidth = 5,
fill = "darkgrey")
gives me error
Error in `check_aesthetics()`:
! Aesthetics must be either length 1 or the same as the data (500): x
Run `]8;;rstudio:run:rlang::last_error()rlang::last_error()]8;;` to see where the error occurred.
which, I believe, resulted from using whole ICUData in ggplot but only ICUData.neuro as aes value. Compare:
ggplot(ICUData.ne...