Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# Install required packages for RTutor from CRAN and Github
# Run this code if you want to install RTutor problem sets on
# Otherwise you can more easily install RTutor via
# install.packages("RTutor",repos = c("",getOption("repos")))
install.rtutor = function(update.cran=FALSE, update.github=TRUE, lib=.libPaths()[1], upgrade="never", force=TRUE,...) {
cat("\nInstall required packages from CRAN...")
# Avoid devtools::install_github warnings converted to errors
# See
pkgs = c("withr","devtools","whisker","stringr","jsonlite","data.table","markdown","DT","dplyr","shiny","shinyBS","hwriter","lmtest","texreg","RCurl", "memoise","shinyAce","restorepoint")
for (pkg in pkgs) {
if (!update.cran) {
if (!require(pkg, character.only=TRUE) | update.cran)
} else {
try(detach(paste0("package:",pkg), character.only=TRUE, force=TRUE), silent=TRUE)
cat("\nInstall required packages from Github...")
# Install packages from Github
repos = c(
for (repo in repos) {
pkg = strsplit(repo,"/", fixed=TRUE)[[1]][2]
if (!update.github) {
if (!require(pkg, character.only=TRUE) | overwrite.github)
try(with_libpaths(new = lib, devtools::install_github(repo=repo, upgrade=upgrade,...)))
} else {
try(detach(paste0("package:",pkg), character.only=TRUE,force=TRUE), silent=TRUE)
try(with_libpaths(new = lib, devtools::install_github(repo=repo, upgrade=upgrade, force=force,...)))
# install.rtutor()

This comment has been minimized.

Copy link

@novica novica commented Apr 29, 2019

On line 10 "memoise" is listed twice. Is that needed?


This comment has been minimized.

Copy link
Owner Author

@skranz skranz commented Sep 18, 2019

Sorry, somehow I did not get a notification that there was a comment. Today, I just looked for another reason at the gist and saw it. You are of course completely, right: one time "memoise" is of course enough. I have updated the gist. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.