diff --git a/R/read_peaklist.R b/R/read_peaklist.R index 3bc6325..b1ded8d 100644 --- a/R/read_peaklist.R +++ b/R/read_peaklist.R @@ -7,7 +7,8 @@ #' the function with a folder or vector of folders containing the files. #' Otherwise, set to\code{FALSE}. #' @param format_in Format of files to be imported/converted. Current options -#' include: \code{chemstation} or \code{shimadzu}. +#' include: \code{chemstation}, \code{shimadzu_fid}, \code{shimadzu_dad}, +#' \code{shimadzu_lcd}, and \code{shimadzu_gcd}. #' @param pattern pattern (e.g. a file extension). Defaults to NULL, in which #' case file extension will be deduced from \code{format_in}. #' @param data_format Either \code{chromatographr} or \code{original}. @@ -33,14 +34,16 @@ read_peaklist <- function(paths, find_files, format_in = c("chemstation", "shimadzu_fid", - "shimadzu_dad"), + "shimadzu_dad", "shimadzu_lcd", + "shimadzu_gcd"), pattern = NULL, data_format = c("chromatographr", "original"), metadata_format = c("chromconverter", "raw"), read_metadata = TRUE, progress_bar, cl = 1){ data_format <- match.arg(tolower(data_format), c("chromatographr", "original")) format_in <- match.arg(tolower(format_in), - c("chemstation", "shimadzu_fid", "shimadzu_dad")) + c("chemstation", "shimadzu_fid", "shimadzu_dad", + "shimadzu_lcd", "shimadzu_gcd")) if (missing(progress_bar)){ progress_bar <- check_for_pkg("pbapply", return_boolean = TRUE) } @@ -62,12 +65,18 @@ read_peaklist <- function(paths, find_files, parser <- purrr::partial(read_chemstation_reports, data_format = data_format, metadata_format = metadata_format) - } else if (grepl("shimadzu", format_in)){ + } else if (format_in %in% c("shimadzu_dad", "shimadzu_fid")){ pattern <- ifelse(is.null(pattern), ".txt", pattern) parser <- partial(read_shimadzu, what = "peak_table", data_format = "wide", read_metadata = read_metadata, peaktable_format = data_format) + } else if (format_in == "shimadzu_lcd"){ + parser <- partial(read_shimadzu_lcd, what = "peak_table", + data_format="wide", read_metadata=read_metadata) + } else if (format_in == "shimadzu_gcd"){ + parser <- partial(read_shimadzu_gcd, what = "peak_table", + data_format="wide", read_metadata=read_metadata) } if (find_files){ @@ -97,10 +106,10 @@ read_peaklist <- function(paths, find_files, data <- lapply(seq_along(data), function(i){ if (inherits(data[[i]], "list")){ lapply(data[[i]], function(xx){ - cbind(sample = file_names[i], xx) + cbind(Sample = file_names[i], xx) }) } else { - cbind(sample = file_names[i], data[[i]]) + cbind(Sample = file_names[i], data[[i]]) } }) class(data) <- "peak_list" diff --git a/R/read_shimadzu_ascii.R b/R/read_shimadzu_ascii.R index 536ab03..6d0e21d 100644 --- a/R/read_shimadzu_ascii.R +++ b/R/read_shimadzu_ascii.R @@ -306,8 +306,8 @@ read_shimadzu_peaktable <- function(path, x, idx, sep, format_in, format_out){ t1 <- strsplit(x = x[[table_start + 3]], split = sep)[[1]][time_column] decimal_separator <- ifelse(grepl(",", t1), ",", ".") - peak_tab <- read.csv(path, skip = table_start-1, sep = sep, nrows = nrows, - dec = decimal_separator) + peak_tab <- read.csv(path, skip = (table_start-1), sep = sep, nrows = nrows, + dec = decimal_separator, check.names = FALSE) if (format_out == "chromatographr"){ column_names <- switch(format_in, "MC" = c("Ret.Time", "Proc.From", "Proc.To", "Area", "Height"), diff --git a/man/read_peaklist.Rd b/man/read_peaklist.Rd index 52e9b8f..97b526f 100644 --- a/man/read_peaklist.Rd +++ b/man/read_peaklist.Rd @@ -7,7 +7,8 @@ read_peaklist( paths, find_files, - format_in = c("chemstation", "shimadzu_fid", "shimadzu_dad"), + format_in = c("chemstation", "shimadzu_fid", "shimadzu_dad", "shimadzu_lcd", + "shimadzu_gcd"), pattern = NULL, data_format = c("chromatographr", "original"), metadata_format = c("chromconverter", "raw"), @@ -24,7 +25,8 @@ the function with a folder or vector of folders containing the files. Otherwise, set to\code{FALSE}.} \item{format_in}{Format of files to be imported/converted. Current options -include: \code{chemstation} or \code{shimadzu}.} +include: \code{chemstation}, \code{shimadzu_fid}, \code{shimadzu_dad}, +\code{shimadzu_lcd}, and \code{shimadzu_gcd}.} \item{pattern}{pattern (e.g. a file extension). Defaults to NULL, in which case file extension will be deduced from \code{format_in}.}