Here’s how to install R packages from within R.

install.packages("ggplot2")