Skip to content

Commit

Permalink
Parse CSV enclosure character from header before separator is parsed
Browse files Browse the repository at this point in the history
  • Loading branch information
DrEspresso committed May 7, 2024
1 parent 5bdde45 commit 04a4fea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/read_export_options.R
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,16 @@ read_export_options <- function(data_dir) {
meta_available[entry] <- .construct_metaname(entry, meta_names, file_tag, file_extension) %in% files$Name
}

# find form data separator ----
# find form data separator and enclosure ----
if (is_zip) {
file_con <- unz(data_dir, files$Name[!grepl("html$", files$Name)][1])
header <- readLines(file_con, 1)
close(file_con)
} else if (!is_zip) {
header <- readLines(file.path(data_dir, files$Name[!grepl("html$", files$Name)][1]), 1)
}
quote <- substr(header, 1, 1)
header <- gsub(quote,1,1)
if (grepl(",", header)) {
sep <- ","
} else if (grepl("'", header)) {
Expand Down

0 comments on commit 04a4fea

Please sign in to comment.