R/read_varian_peaklist.R

Defines functions read_varian_peaklist

Documented in read_varian_peaklist

#' Read 'Varian' peaklist.
#' Read peak list(s) from 'Varian MS Workstation'.
#' @param path Path to Varian peak list file.
#' @importFrom utils read.csv
#' @author Ethan Bass
#' @return A data.frame containing the information from the specified report.
#' @export

read_varian_peaklist <- function(path){
  x <- read.csv(path, skip = 5, header = FALSE)
  x$V1[x$V1 == ""] <- NA
  x <- tidyr::fill(data = x, "V1", .direction = "down")

  column_names <- x[1,]
  column_names[1] <- "compound"
  colnames(x) <- column_names

  x <- x[-which(x$`Line#` == ""),]
  x <- x[-which(x$`Line#` == "Line#"),]

  x$Area <- as.numeric(x$Area)
  x$Height <- as.numeric(x$Height)
  x <- x[, -16]
  x
}
ethanbass/chromConverter documentation built on Jan. 14, 2025, 2:11 a.m.