Skip to content

Instantly share code, notes, and snippets.

@karthik
Created February 7, 2014 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karthik/8867626 to your computer and use it in GitHub Desktop.
Save karthik/8867626 to your computer and use it in GitHub Desktop.
Checking package installation
if(!require(testthat)) {
install.package("testthat")
}
library(testthat)
# If you're going to require dplyr it would make sense to have students be on at least version 3.
expect_equal(R.version$major, "3")
package_list <- installed.packages (fields = c ("Package", "Version"))
# Next check to see that people have at least the major versions of key packages
expect_equal(package_list["plyr","Version"], "1.8")
# And similarly for the remaining packages
# Last bit only makes sense if you need the use of devtools
# Looks like you don't though since you wont be installing anything from GitHub
# or teaching any parts of package developement. In case you needed it:
library(devtools)
expect_true(has_devel())
# This should return true of people have correctly followed instructions for their OS.
# More info here: https://github.com/karthik/dlab-advanced-r/blob/master/installation.md#installation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment