From 49517c12b49f972cb1744c4f0ef69860d67eba25 Mon Sep 17 00:00:00 2001 From: Julian Karch Date: Mon, 7 Oct 2024 14:12:15 +0200 Subject: [PATCH] bugfix csv data reader --- R/serverDataUploader.R | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/R/serverDataUploader.R b/R/serverDataUploader.R index 716a11b..fcb959f 100644 --- a/R/serverDataUploader.R +++ b/R/serverDataUploader.R @@ -53,11 +53,20 @@ read_auto <- function(filepath) { file_ext <- tools::file_ext(filepath) read_csv <- function(filepath) { sep_head <- determine_seperator_header(filepath) - data <- readr::read_delim(filepath, - delim = sep_head$separator, - col_names = sep_head$has_header, - trim_ws = TRUE - ) + if(sep_head$separator == " "){ + print("read_table") + data <- readr::read_table(filepath, + col_names = sep_head$has_header) + }else if (sep_head$separator == ","){ + data <- readr::read_csv(filepath, + col_names = sep_head$has_header) + }else{ + data <- readr::read_delim(filepath, + delim = sep_head$separator, + col_names = sep_head$has_header, + trim_ws = TRUE + ) + } return(data) }