utils: Move library() calls to beginning of file

It seems that calling library() within a function may fail silently.
Moving them out of the function at the beginning of utils.R fixes this.
One particular place, where all necessary libraries are loaded, seem to
be a much easier way than inside a function.
This commit is contained in:
Jens Sauer 2020-11-18 10:26:45 +01:00
parent 792b42373e
commit d96e3c5ed8

10
utils.R
View File

@ -3,6 +3,10 @@
# License: GPL version 3
# Jens Mathis Sauer (c) 2020
library(survival)
library(survminer)
library(tidyverse)
#
# Write plot to filename
#
@ -95,12 +99,6 @@ sma_break.time.by = 5 * 365.25
sma_init <- function() {
if (exists("sma_initialized") == FALSE) {
print("Initialize secMalASCT workspace")
print("Loading libraries")
library(survival)
library(survminer)
library(tidyverse)
print("Loading data")
#
# Use superassignment operator '<<-' to make