Skip to content

Commit

Permalink
style: whitespace, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanbass committed Jul 30, 2023
1 parent f99f4b1 commit 78f3a8f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions R/read_chroms.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"))
Expand Down Expand Up @@ -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])
Expand All @@ -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)
Expand Down

0 comments on commit 78f3a8f

Please sign in to comment.