dependencies.R 1.63 KB
Newer Older
ashtondrew's avatar
ashtondrew committed
1 2 3 4 5 6
# This code was provided by SESYNC to ensure dependencies captured during transfer to their servers


# List the package and version as below
dependencies <- read.csv(textConnection("
                                        Package,     Min.Version
7
                                        shiny,       1.1.0
ashtondrew's avatar
ashtondrew committed
8 9 10
                                        readr,       1.1.1
                                        magrittr,    1.5
                                        plyr,        1.8.4
11 12 13 14 15 16 17 18
                                        dplyr,       0.7.6
                                        tidyr,       0.8.1
                                        forcats,     0.3.0
                                        ggplot2,     3.0.0
                                        scales,      1.0.0
                                        DT,          0.4
                                        #ReporteRsjars, 0.0.2
                                        #ReporteRs,   0.8.8
ashtondrew's avatar
ashtondrew committed
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
                                        "), stringsAsFactors = FALSE, strip.white = TRUE)

## No changes necessary below. ##

# Import installed package versions
pkgs <- installed.packages()
rownames(pkgs) <- c()
pkgs <- data.frame(pkgs, stringsAsFactors = FALSE)

# Compare requirements to installed packages
pkgs <- merge(dependencies, pkgs, by="Package", all.x=TRUE)

# Filter out packages meeting minimum version requirement
pkgs <- pkgs[mapply(compareVersion, pkgs$Min.Version, pkgs$Version) > 0, ]

# Install missing and newer packages
lapply(pkgs$Package, install.packages, repos="http://cran.us.r-project.org")

# Require dependencies [optional]
lapply(dependencies$Package, require, character.only=TRUE)