Reputation: 3
I have installed R and RStudio but I believe I have set the environment variables correctly. I have installed ggplot2 along with its dependencies but I am unable to load ggplot2 even after running RStudio as admin. Here are some glimpses:
> install.packages("ggplot2", dependencies = TRUE)
Installing package into ‘C:/Users/mosen/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
Then I get to see the notifications of the dependent packages getting installed from various CRAN urls and then the unpacking of those packages....
package ‘knitr’ successfully unpacked and MD5 sums checked
package ‘rmarkdown’ successfully unpacked and MD5 sums checked
package ‘svglite’ successfully unpacked and MD5 sums checked
package ‘ggplot2’ successfully unpacked and MD5 sums checked
etc. Then after certain verification I get the message,
The downloaded source packages are in
‘C:\Users\mosen\AppData\Local\Temp\RtmpCOIHuQ\downloaded_packages’
I could see the zipped files in this directory. However,
> load("ggplot2")
Error in readChar(con, 5L, useBytes = TRUE) : cannot open the
connection
In addition: Warning message:
In readChar(con, 5L, useBytes = TRUE) :
cannot open compressed file 'ggplot2', probable reason 'No such
file or directory'
Please help! My working directory is "C:/Users/mosen/Documents".
Upvotes: 0
Views: 1493
Reputation: 6132
I think you just need library(ggplot2)
or require(ggplot2)
instead of load(ggplot2)
after install.packages("ggplot2")
. Load("...")
is a function to load datasets, not to enable using functions from packages.
Upvotes: 2