Skip to content

Commit

Permalink
bugfix csv data reader
Browse files Browse the repository at this point in the history
  • Loading branch information
karchjd committed Oct 7, 2024
1 parent 3f86e85 commit 49517c1
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions R/serverDataUploader.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 49517c1

Please sign in to comment.