Skip to content

Instantly share code, notes, and snippets.

@sithjaisong
Created January 14, 2017 15:22
Show Gist options
  • Select an option

  • Save sithjaisong/62a092efc8636cb13bffd957813efa86 to your computer and use it in GitHub Desktop.

Select an option

Save sithjaisong/62a092efc8636cb13bffd957813efa86 to your computer and use it in GitHub Desktop.
You newly install R program when all of your packages are lost.
# List of useful packages
pkg <- c("tidyr", "dplyr", "ggplot2", "knitr", "rmarkdown")
# Check if packages are not installed and assign the
# names of the uninstalled packages to the variable new.pkg
new.pkg <- pkg[!(pkg %in% installed.packages())]
# If there are any packages in the list that aren't installed,
# install them
if (length(new.pkg)) {
install.packages(new.pkg, repos = "http://cran.rstudio.com")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment