I'm using VS code and I am trying to learn the ggplot2 package in R. I installed ggplot2 in the base R console and then from the VS Code editor, as per this post's suggestion: How to install R packages in VS code
install.packages('ggplot2', repos='http://cran.us.r-project.org')
I then downloaded an external dataset to use it to learn ggplot2:
load(url('https://github.com/matloff/fasteR/blob/master/data/mlb.RData?raw=true'))
Then I tried to assign the output of ggplot2, on the mlb dataset, to a variable:
p <- ggplot2(mlb)
I get this error:
Error in ggplot2(mlb) : could not find function "ggplot2"
This is happening with other packages as well. For reference, my current directory is: "/Users/saunok/Library/CloudStorage/Dropbox/Areas_of_Responsibility/Programming/R"
The installed packages are being installed in: "/var/folders/hq/lbddkgmd0fbbp1r2lqsp7nkm0000gn/T//RtmpYA5gLR/downloaded_packages"
I tried: To use installed R packages in VS Code I expected: To be able to use the package for analysis Result: R or VS Code is failing to detect the installed packages.