From 73b0a70138cbe7bfbee48ca2db90a7cba74050a8 Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Fri, 9 Aug 2024 13:55:55 +0200 Subject: [PATCH] `process_BAPS_data()` can handle file being an R object --- R/process_BAPS_data.R | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/R/process_BAPS_data.R b/R/process_BAPS_data.R index 7a76bf6..1bc61cf 100644 --- a/R/process_BAPS_data.R +++ b/R/process_BAPS_data.R @@ -2,14 +2,23 @@ process_BAPS_data <- function(file, partitionCompare) { if (!is.null(partitionCompare)) { cat('Data:', file, '\n') } - data <- read.table(file) - ninds <- testaaOnkoKunnollinenBapsData(data) # for testing purposes? + + # Importing data + if (is.character(file)) { + data <- read.table(file) + } else { + data <- file + } + + ninds <- testaaOnkoKunnollinenBapsData(data) # Checks if last column is ID if (ninds == 0) { warning('Incorrect Data-file.') return(NULL) } + popnames <- NULL # Dropped specification of population names (from BAPS 6) + # Processing data result <- handleData(data, format = "BAPS") data <- result$newData rowsFromInd <- result$rowsFromInd