forked from saikath1/srt.core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_script.R
More file actions
executable file
·33 lines (28 loc) · 2.02 KB
/
install_script.R
File metadata and controls
executable file
·33 lines (28 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env Rscript
if(!require(testthat)) {
install.packages("testthat", repos="http://cran.rstudio.com/")
library("testthat")
} #DT
#This file should be run the first time using this program to ensure R is up to date and all dependencies are intalled and loaded
#will aotomatically update R if on windows, and install all packages for any platform.
#run via source with echo in the top right drop down menu, or with Ctrl+Shift+Enter
if (version$major < 3 || (version$major == 3 && version$minor < 2.2)){ #checks if R is already up to date
#update R
if(.Platform$OS.type == "windows"){#automatic update for windows users
if(!require(installr)) {
install.packages("installr", repos="http://cran.rstudio.com/"); library(installr)} #load / install+load installr
# using the package:
updateR() # this will start the updating process of your R installation. It will check for newer versions, and if one is available, will guide you through the decisions you'd need to make.
}
else{
#print explainationfor non-windows users
stop("Your machine requires a newer version of R. Please download the updated version for your platform at https://cran.rstudio.com/")
}
}
#checks for each dependancy and loads or installs then loads
if(!require(shiny)) {install.packages("shiny", repos="http://cran.rstudio.com/");library(shiny)} #shiny is the main interface package
if(!require(DT)) {install.packages("DT", repos="http://cran.rstudio.com/");library(DT)} #DT
if(!require(knitr)) {install.packages("knitr", repos="http://cran.rstudio.com/");library(knitr)} #DT
if(!require(gdata)) {install.packages("gdata", repos="http://cran.rstudio.com/");library(gdata)} #gdata is used for manipulating the data out of an excel sheet
if(!require(ggplot2)) {install.packages("ggplot2", repos="http://cran.rstudio.com/");library(ggplot2)} #ggplot2 is used for crerating various plots
if(!require(rootSolve)) {install.packages("rootSolve", repos="http://cran.rstudio.com/");library(rootSolve)} #rootSolve is used for finding a root of an equation