forked from vynguyen92/publish_nhanes_data_1988_2018
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathf - install_packages_upload_libraries.R
executable file
·149 lines (108 loc) · 4.81 KB
/
f - install_packages_upload_libraries.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
############################# FUNCTION TO INSTALL AND UPLOAD LIBRARIES ######################################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Purpose: This function serves as a repository of libraries needed for analysis
#
# Inputs: none
#
# Outputs: none - necessary libraries are installed and uploaded into RStudio to prepare for analysis
install_packages_upload_libraries <- function()
{
# Install and upload nhanesA package to obtain access to all NHANES datasets
# https://cran.r-project.org/web/packages/nhanesA/vignettes/Introducing_nhanesA.html
install.packages("nhanesA")
library("nhanesA")
# Install and upload readtext package for reading text to upload mortality data
install.packages("readtext")
library("readtext")
# Install and upload readxl package to help upload datasets from excel
install.packages("readxl")
library("readxl")
# Install and upload survival package to have access to survival models
install.packages("survival")
library("survival")
# Install and upload survminer package to have access to functions used for making plots from survival data
install.packages("survminer")
library("survminer")
# Install and upload sjlabelled package to dealed with labelled data
install.packages("sjlabelled")
library("sjlabelled")
# Install and upload gtable package to help make figures made of multiple plots
install.packages("gtable")
library("gtable")
# Upload gtable package to help make figures made of multiple plots and label axes of these figures
library("gridExtra")
# Upload gtable package to help label plots within the same figure
library("grid")
install.packages("gplots")
library(gplots)
# library("Hmisc")
# Upload ggrepel package to help avoid overlapping text labels
library("ggrepel")
# library("MASS")
# Upload ggrepel package to help with scales of axes in plots
library("scales")
# Install and upload janitor package to help with examining and cleaning data
install.packages("janitor")
library("janitor")
# Install and upload survey package to access function to run survey-weighted regression models
install.packages("survey")
library("survey")
# Upload RColorBrewer package to have access to different color schemes to make figures
library("RColorBrewer")
# Install and upload cowplot package to extract legends to make a composite legend
install.packages("cowplot")
library("cowplot")
# Install and upload survMisc package to help with making predicted mortality risk
install.packages("survMisc")
library("survMisc")
# install.packages("pec")
# library("pec")
# install.packages("coxrt")
# library("coxrt")
# Install and upload caret package to help cross-validation
install.packages("caret")
library("caret")
# Install and upload glmnet package to help cross-validation for cox models
install.packages("glmnet")
library("glmnet")
# Install and upload boot package to help to implement bootstrapping
install.packages("boot")
library("boot")
# Install and upload boot package to help to implement bootstrapping
install.packages("bootstrap")
library("bootstrap")
# Upload splines package to implement splines models
library("splines")
# library("rms")
# install.packages("Greg")
# library("Greg")
# Install and upload features package to help with extracting critical points
install.packages("features")
library("features")
# Needed to run on Microsoft Open R 3.5.3 for threading on high computing computer
options(repos = c(CRAN = "https://cran.rstudio.com"))
# Install and upload pillar package to help format columns of data using colors
# Needed to run analysis on high computing computer
install.packages("pillar")
library("pillar")
# Install and upload vctrs package to help format vectors
# Needed to run analysis on high computing computer
install.packages("vctrs", dependencies = TRUE)
library("vctrs")
# Install and upload tidyverse package for access to functions to faciliate ease of getting statistics
install.packages("tidyverse", dependencies = TRUE)
library("tidyverse")
# Install and upload broom package to help format results of regression models into a tidy dataset
install.packages("broom", dependencies = TRUE)
library("broom")
# Upload library to help with parallel computing
library("parallel")
# Upload library to help with parallel computing specifically for a for loop
library("foreach")
# Install and upload library to help with parallel computing
install.packages("doParallel")
library("doParallel")
install.packages("pvclust")
library("pvclust")
}