From 78f3a8f5b8231aea8e7a419850a4422426bfe0f8 Mon Sep 17 00:00:00 2001 From: Ethan Bass Date: Sun, 30 Jul 2023 11:05:07 -0400 Subject: [PATCH] style: whitespace, etc --- R/read_chroms.R | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/R/read_chroms.R b/R/read_chroms.R index f4fffee..75495d7 100644 --- a/R/read_chroms.R +++ b/R/read_chroms.R @@ -68,7 +68,7 @@ #' @export read_chroms read_chroms <- function(paths, find_files, - format_in=c("agilent_d", "chemstation", "chemstation_uv", + format_in = c("agilent_d", "chemstation", "chemstation_uv", "chemstation_csv", "chemstation_ch", "chemstation_fid", "masshunter_dad", "shimadzu_fid", "shimadzu_dad", "chromeleon_uv", @@ -80,7 +80,8 @@ read_chroms <- function(paths, find_files, format_out = c("matrix", "data.frame"), data_format = c("wide","long"), export = FALSE, path_out = NULL, - export_format = c("csv", "chemstation_csv", "cdf", "mzml", "animl"), + export_format = c("csv", "chemstation_csv", "cdf", + "mzml", "animl"), read_metadata = TRUE, progress_bar, sample_names = NULL, dat = NULL){ data_format <- match.arg(data_format, c("wide","long")) @@ -273,7 +274,9 @@ read_chroms <- function(paths, find_files, file_names <- strsplit(files, "/") file_names <- gsub("\\.[Dd]", "", sapply(file_names, function(n){ - ifelse(any(grepl("\\.[Dd]", n)), grep("\\.[Dd]", n, value = TRUE), tail(n,1)) + ifelse(any(grepl("\\.[Dd]", n)), + yes = grep("\\.[Dd]", n, value = TRUE), + no = tail(n,1)) })) } else { file_names <- sapply(strsplit(basename(files),"\\."), function(x) x[1]) @@ -300,10 +303,11 @@ read_chroms <- function(paths, find_files, names(data) <- file_names } if (export & !(parser %in% c("thermoraw", "openchrom"))){ - writer <- switch(export_format, csv = export_csvs, - chemstation_csv = purrr::partial(export_csvs, fileEncoding = "utf16"), + writer <- switch(export_format, + csv = export_csvs, + chemstation_csv = purrr::partial(export_csvs, + fileEncoding = "utf16"), cdf = export_cdfs) - writer(data, path_out) } dat <- append(dat, data)