Created
February 7, 2014 17:31
-
-
Save karthik/8867626 to your computer and use it in GitHub Desktop.
Checking package installation
This file contains 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
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