Installs libraries for an R script
This little package can install and load libraries which are needed for any R script. It scan through the script file, then install the dependencies. Also you can define a yaml file, that contains the dependencies and the package will load/install them.
I wrote this package for fun and learning purpose. But I hope, that it will may useful for somebody.
library(devtools)
install_github("horver/InstallR")
install_from_list
Install and load from vector:This function installs and loads (if load
TRUE
) the libraries which are given by a c()
vector.
install_from_list(c("RUnit", "caret"), load = TRUE)
install_from_script
Install and load from file(s):This function scans through an R script or scripts ( c("file1.R", "file2.R")
) then
installs and loads (if load TRUE) the libraries.
install_from_script("file.R", load = TRUE)
install_from_yml
Install and load from YAML:Needed libraries are in a *.yml
file. The structure should look like this:
deps:
- testthat
- RUnit
- caret
load: true
And usage of the function:
install_from_yml("deps.yml", load = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.