Running examples in ‘eHDPrep-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: metavariable_agg
> ### Title: Aggregate Data by Metavariable
> ### Aliases: metavariable_agg
> 
> ### ** Examples
> 
> require(magrittr)
Loading required package: magrittr
> require(dplyr)
Loading required package: dplyr

Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union

> data(example_ontology)
> data(example_mapping_file)
> data(example_data)
> 
> #' # define datatypes
> tibble::tribble(~"var", ~"datatype",
+ "patient_id", "id",
+ "tumoursize", "numeric",
+ "t_stage", "ordinal_tstage",
+ "n_stage", "ordinal_nstage",
+ "diabetes_merged", "character",
+ "hypertension", "factor",
+ "rural_urban", "factor",
+ "marital_status", "factor",
+ "SNP_a", "genotype",
+ "SNP_b", "genotype",
+ "free_text", "freetext") -> data_types
> 
> # create post-QC data
> example_data %>%
+   merge_cols(diabetes_type, diabetes, "diabetes_merged", rm_in_vars = TRUE) %>%
+   apply_quality_ctrl(patient_id, data_types,
+                      bin_cats =c("No" = "Yes", "rural" = "urban"),
+                      to_numeric_matrix = TRUE) %>%
+                      suppressMessages() ->
+                      post_qc_data

 *** caught segfault ***
address 0x55fe8a087f90, cause 'memory not mapped'

Traceback:
 1: pairlist(get_lines = function (self) {    c(self$lines, self$last_line)}, get_indent = function (self) {    if (self$indent < 0) {        warn("Internal error: Negative indent while deparsing")        0L    } else {        self$indent    }}, push = function (self, lines) {    stopifnot(is_character(lines))    for (line in lines) {        self$push_one(line)    }    self}, push_one = function (self, line) {    line <- line_push(self$last_line, line, sticky = self$next_sticky,         boundary = self$boundary, width = self$width, indent = self$get_indent(),         has_colour = self$has_colour)    n <- length(line)    if (n > 1) {        self$lines <- c(self$lines, line[-n])        self$last_line <- line[[n]]        self$boundary <- NULL        self$next_indent_sticky <- FALSE    } else if (n) {        self$last_line <- line        if (self$next_sticky) {            self$boundary <- nchar(line)        }    }    self$next_sticky <- FALSE    self}, push_newline = function (self) {    self$lines <- c(self$lines, self$last_line)    self$last_line <- spaces(self$get_indent())    self$next_sticky <- FALSE    self$next_indent_sticky <- FALSE    self}, push_sticky = function (self, line) {    stopifnot(is_string(line))    self$next_sticky <- TRUE    self$push(line)    self$set_boundary()    self}, make_next_sticky = function (self) {    self$next_sticky <- TRUE    self}, set_boundary = function (self) {    self$boundary <- nchar(self$last_line)    self}, increase_indent = function (self) {    status <- node_car(self$indent_status)    if (self$next_indent_sticky) {        node_poke_cadr(status, inc(node_cadr(status)))    } else {        self$indent <- self$indent + 2L        self$indent_status <- new_node(new_node(FALSE, new_node(0L,             NULL)), self$indent_status)        self$next_indent_sticky <- TRUE    }    self}, decrease_indent = function (self) {    status <- node_car(self$indent_status)    if (is_null(status)) {        warn("Internal error: Detected NULL `status` while deparsing")        return(self)    }    reset <- node_car(status)    n_sticky <- node_cadr(status)    if (!reset) {        self$indent <- self$indent - 2L        node_poke_car(status, TRUE)        self$next_indent_sticky <- FALSE    }    if (n_sticky >= 1L) {        node_poke_cadr(status, dec(n_sticky))    } else {        self$indent_status <- node_cdr(self$indent_status)        self$next_indent_sticky <- FALSE    }    self})
 2: dplyr::summarise(., dplyr::across(everything(), ~!.x %in% ord_levels))
 3: dplyr::summarise(., dplyr::across(c(!!!vars), sum))
 4: tidyr::pivot_longer(., dplyr::everything())
 5: dplyr::filter(., .data$value > 0)
 6: data %>% dplyr::select(!!!vars) %>% dplyr::summarise(dplyr::across(everything(),     ~!.x %in% ord_levels)) %>% dplyr::summarise(dplyr::across(c(!!!vars),     sum)) %>% tidyr::pivot_longer(dplyr::everything()) %>% dplyr::filter(.data$value >     0)
 7: encode_ordinals(., ord_levels = c("T1", "T2", "T3a", "T3b", "T4",     NA), strict_levels = T, dplyr::all_of(select_by_datatype(class_tbl,     "ordinal_tstage")))
 8: dplyr::select(., !!!vars)
 9: dplyr::summarise(., dplyr::across(everything(), ~!.x %in% ord_levels))
10: dplyr::summarise(., dplyr::across(c(!!!vars), sum))
11: tidyr::pivot_longer(., dplyr::everything())
12: dplyr::filter(., .data$value > 0)
13: data %>% dplyr::select(!!!vars) %>% dplyr::summarise(dplyr::across(everything(),     ~!.x %in% ord_levels)) %>% dplyr::summarise(dplyr::across(c(!!!vars),     sum)) %>% tidyr::pivot_longer(dplyr::everything()) %>% dplyr::filter(.data$value >     0)
14: encode_ordinals(., ord_levels = c("N0", "N1", "N2", NA), strict_levels = T,     dplyr::all_of(select_by_datatype(class_tbl, "ordinal_nstage")))
15: dplyr::mutate(., dplyr::across(c(!!!vars), encode_genotype_vec))
16: data %>% dplyr::mutate(dplyr::across(c(!!!vars), encode_genotype_vec))
17: encode_genotypes(., dplyr::all_of(select_by_datatype(class_tbl,     "genotype")))
18: withCallingHandlers(expr, message = function(c) if (inherits(c,     classes)) tryInvokeRestart("muffleMessage"))
19: suppressMessages(.)
20: dplyr::select(data, !!!dplyr::enquos(...))
21: encode_cats(., dplyr::all_of(select_by_datatype(class_tbl, c("factor",     "character"))))
22: withCallingHandlers(expr, warning = function(w) if (inherits(w,     classes)) tryInvokeRestart("muffleWarning"))
23: suppressWarnings(.)
24: data %>% strings_to_NA(dplyr::all_of(select_by_datatype(class_tbl,     c("id", "numeric", "integer", "double"), negate = TRUE))) %>%     encode_binary_cats(dplyr::all_of(select_by_datatype(class_tbl,         c("character", "factor"))), values = bin_cats) %>% encode_ordinals(ord_levels = c("T1",     "T2", "T3a", "T3b", "T4", NA), strict_levels = T, dplyr::all_of(select_by_datatype(class_tbl,     "ordinal_tstage"))) %>% encode_ordinals(ord_levels = c("N0",     "N1", "N2", NA), strict_levels = T, dplyr::all_of(select_by_datatype(class_tbl,     "ordinal_nstage"))) %>% encode_genotypes(dplyr::all_of(select_by_datatype(class_tbl,     "genotype"))) %>% {    if (length(dplyr::all_of(select_by_datatype(class_tbl, "freetext"))) >         0) {        extract_freetext(., id_var = !!id_var, min_freq = min_freq,             dplyr::all_of(select_by_datatype(class_tbl, "freetext")))    }    else .} %>% suppressMessages() %>% encode_cats(dplyr::all_of(select_by_datatype(class_tbl,     c("factor", "character")))) %>% suppressWarnings()
25: apply_quality_ctrl(., patient_id, data_types, bin_cats = c(No = "Yes",     rural = "urban"), to_numeric_matrix = TRUE)
26: withCallingHandlers(expr, message = function(c) if (inherits(c,     classes)) tryInvokeRestart("muffleMessage"))
27: suppressMessages(.)
28: example_data %>% merge_cols(diabetes_type, diabetes, "diabetes_merged",     rm_in_vars = TRUE) %>% apply_quality_ctrl(patient_id, data_types,     bin_cats = c(No = "Yes", rural = "urban"), to_numeric_matrix = TRUE) %>%     suppressMessages()
An irrecoverable exception occurred. R is aborting now ...
Segmentation fault