-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy path00-Prepare_Computer.R
50 lines (40 loc) · 2 KB
/
00-Prepare_Computer.R
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# A Garch Tutorial with R - R Script for Preparing Computer
# Paper at <https://rac.anpad.org.br/index.php/rac/article/view/1420>
#
# This script will install all missing dependencies for the R code related to article
# "A Garch Tutorial in R" <link-to-paper>. If this is the first time running a R script,
# make sure you got the right software:
#
# 1) [required] Install latest R version <https://www.r-project.org/>
# 2) [optional] Install latest RStudio <https://rstudio.com/products/rstudio/download/>
#
# Preferably, you should execute all scripts in RStudio. If you use other IDE (or none),
# make sure to change the path for setwd() in all scripts.
#
# LINUX users: 1) Install additional libraries: libssl-dev, libxml2-dev, libcurl4-openssl-dev
# In terminal (control+alt+t): "sudo apt install libssl-dev libxml2-dev libcurl4-openssl-dev"
# 2) Just execute this script to install required libraries
#
# WINDOWS users: 1) Simply execute this script to install required libraries
#
# MAC users: 1) Simply execute this script to install required libraries
#
# Alternatively, you can execute the code using RStudio Cloud at the following,
# public available, project: https://rstudio.cloud/project/1371589
# list of required packages
required_pkgs <- c('tidyverse' , 'ggtext' , 'rugarch',
'BatchGetSymbols', 'GetBCBData', 'cowplot',
'purrr' , 'tidyr' , 'FinTS' ,
'scales' , 'texreg' , 'knitr' ,
'kableExtra' , 'forecast' , 'writexl')
# finds installed pkgs from R session
installed_pkgs <- installed.packages()
# find missing packages
missing_pkgs <- required_pkgs[!(required_pkgs %in% installed_pkgs[, 1])]
if (length(missing_pkgs) == 0 ) {
message("No missing dependencies. You are good to go!")
} else {
install.packages(missing_pkgs)
message("All packages installed. You are good to go!")
}
message("You should now execute the first script: 01-Get_Index_Data.R")