DS4PS / cpp-524-sum-2021

Course shell for CPP 524 Foundations of Program Evaluation II
http://ds4ps.org/cpp-524-sum-2021/
1 stars 1 forks source link

Lab02-can't load "ggplot2: #13

Open chmao99 opened 3 years ago

chmao99 commented 3 years ago
library( dplyr )
library( pander )
library( ggplot2 )

Error in library(ggplot2) : there is no package called ‘ggplot2’

It seems that I can't load package "ggplot2". What should I do? Thanks in advance!

lecy commented 3 years ago

If the package has not already been installed you need to run the install command first.

install.packages( "ggplot2" )

These details are covered extensively in CPP 526. The material is a slightly out of order when you have a summer start, so these questions are welcome if you are getting stuck.

lecy commented 3 years ago

Some references if helpful:

http://ds4ps.org/dp4ss-textbook/ch-010-core-r.html

Note that you should not include the install command in an RMD document, only the load ("library") command. You only need to install the package once. You can then load it any time you need it.

You cannot install packages during a knit.