forked from vnagaraju14/SFRAT_Automated-Report-Generation
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstallscript.R
More file actions
33 lines (27 loc) · 2.28 KB
/
installscript.R
File metadata and controls
33 lines (27 loc) · 2.28 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
#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{
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
install.packages("htmltools")
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
if(!require(readxl)) {install.packages("readxl", repos="http://cran.rstudio.com/");library(readxl)} #
if(!require(markdown)) {install.packages("readxl", repos="http://cran.rstudio.com/");library(markdown)} #
if(!require(rmarkdown)) {install.packages("readxl", repos="http://cran.rstudio.com/");library(rmarkdown)} #
if(!require(formatR)) {install.packages("readxl", repos="http://cran.rstudio.com/");library(formatR)} #