R/extractSampleData.R

Defines functions extractSampleData

Documented in extractSampleData

#' Extract the sample datasets
#'
#' Extracts the sample datasets from the ZIP files in the \code{extdata}
#' directory.
#' @param somascanMenuVersion String describing which data file to extract.
#' Either "1.3k" or "1.1k".
#' @param intermediateDir A path to a directory to extract the ADATY file into.
#' @return A path to the extracted ADAT file.
#' @examples
#' extractSampleData() ##1.3k dataset by default
#' extractSampleData("1.1k")
#' @importFrom utils unzip
#' @export
extractSampleData <- function(somascanMenuVersion = c("1.3k", "1.1k"),
  intermediateDir = tempdir())
{
  somascanMenuVersion <- match.arg(somascanMenuVersion)
  if(!file.exists(intermediateDir))
  {
    dir.create(intermediateDir, recursive = TRUE)
  }
  zipFile <- system.file(
    "extdata",
    paste("PLASMA", somascanMenuVersion, "20151030.adat.zip", sep = "."),
    package = "readat"
  )
  unzip(zipFile, exdir = intermediateDir)
  file.path(
    intermediateDir,
    paste(
      "PLASMA",
      somascanMenuVersion,
      "HybNorm.MedNorm.Cal.20151030.adat",
      sep = "."
    )
  )
}

Try the readat package in your browser

Any scripts or data that you put into this service are public.

readat documentation built on Oct. 31, 2019, 8:19 a.m.