Skip to content

Instantly share code, notes, and snippets.

@allenh1
Created May 15, 2018 22:07
Show Gist options
  • Select an option

  • Save allenh1/9ca96b09d74a6b163ac2f4e394d4fbc1 to your computer and use it in GitHub Desktop.

Select an option

Save allenh1/9ca96b09d74a6b163ac2f4e394d4fbc1 to your computer and use it in GitHub Desktop.
How to check if something is installed in R
check.installed <- function(pkgname) {
is.element(pkgname, installed.packages()[ , 1])
}
## Verify that mosaic is installed!
if (!check.installed("mosaic")) {
install.packages("mosaic");
}
library(mosaic)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment