problem installing packages - as ‘lib’ is unspecified

Hi, I'm new to R and for some reason I have problem using packages,

for example, after I write:
install.packages("ggplot2")

it says:

install.packages("ggplot2")
Installing package into ‘C:/Users/shper/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/bin/windows/contrib/4.1/ggplot2_3.3.5.zip'
Content type 'application/zip' length 4129299 bytes (3.9 MB)
downloaded 3.9 MB

package ‘ggplot2’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\shper\AppData\Local\Temp\Rtmp0OnZLn\downloaded_packages

I'd love some help, thanks!

You are not showing any error message, just normal installation messages. As far as we can see you have successfully installed ggplot2 in your system.

This is just an informative message that is letting you know that since you haven't specified otherwise, the package has been installed on the default package library.

but after I try a function with it and it says:

Error in ggplot2(df, aes(a, b)) : could not find function "ggplot2"

what should I do?

thanks for the response!

It looks like you installed the package in your library but did not load it into the environment with the library() function. You install packages once and then load the ones you want to use for each r session. Try running library(ggplot2).

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.