Created
January 14, 2017 15:22
-
-
Save sithjaisong/62a092efc8636cb13bffd957813efa86 to your computer and use it in GitHub Desktop.
You newly install R program when all of your packages are lost.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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