Hello All,
I have installed R (version 4.0) as well as ggplot2 (version 3.3.1) and the tidyverse packge. I was going through some code from the book "R for Data Science". I was working with the diamonds dataset when I encountered the problem. I tried the following code:
library(ggplot2)
ggplot(data=diamonds) +
geom_bar(mapping=aes(cut))
which produced the expected bar graph. Then I tried:
ggplot(data=diamonds) +
geom_bar(mapping=aes(cut, color = cut))
This did not produce anything and caused R to hang -- I had to kill R to exit. This happened regardless of whether I was in RStudio or using R from the terminal. The curious thing is that both of the above codes work just fine with the mpg dataset. My machine is Lenovo IdeaPad Flex running Ubuntu linux 20.04 LTS with 16GB of RAM and the processor is Intel i7 8th gen with GPU so resources should not be an issue for handling the large diamonds dataset--which is not really that large but certainly larger than the mpg dataset. The exact same thing was happening with R version 3.6.3 which I replaced with version 4.0.
Any help in understanding and eventually resolving this issue is greatly appreciated.
UPDATE: I discovered that if I plot a histogram of the some variable in the dataset and then do a bar graph using color or fill then everything works as expected !!!!
Cheers,
Aref