% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/methods-OnDiskMSnExp.R, R/methods-XCMSnExp.R
\docType{methods}
\name{extractMsData,OnDiskMSnExp-method}
\alias{extractMsData,OnDiskMSnExp-method}
\alias{extractMsData,XCMSnExp-method}
\alias{extractMsData}
\title{DEPRECATED: Extract a \code{data.frame} containing MS data}
\usage{
\S4method{extractMsData}{OnDiskMSnExp}(object, rt, mz, msLevel = 1L)

\S4method{extractMsData}{XCMSnExp}(object, rt, mz, msLevel = 1L,
  adjustedRtime = hasAdjustedRtime(object))
}
\arguments{
\item{object}{A \code{XCMSnExp} or \code{OnDiskMSnExp} object.}

\item{rt}{\code{numeric(2)} with the retention time range from which the
data should be extracted.}

\item{mz}{\code{numeric(2)} with the mz range.}

\item{msLevel}{\code{integer} defining the MS level(s) to which the data
should be sub-setted prior to extraction; defaults to
\code{msLevel = 1L}.}

\item{adjustedRtime}{(for \code{extractMsData,XCMSnExp}): \code{logical(1)}
specifying if adjusted or raw retention times should be reported.
Defaults to adjusted retention times, if these are present in
\code{object}.}
}
\value{
A \code{list} of length equal to the number of samples/files in
\code{object}. Each element being a \code{data.frame} with columns
\code{"rt"}, \code{"mz"} and \code{"i"} with the retention time, mz and
intensity tuples of a file. If no data is available for the mz-rt range
in a file a \code{data.frame} with 0 rows is returned for that file.
}
\description{
\strong{UPDATE}: the \code{extractMsData} and \code{plotMsData} functions are deprecated
and \code{as(x, "data.frame")} and \code{plot(x, type = "XIC")} (\code{x} being an
\code{OnDiskMSnExp} or \code{XCMSnExp} object) should be used instead. See examples
below. Be aware that filtering the raw object might however drop the
adjusted retention times. In such cases it is advisable to use the
\code{\link[=applyAdjustedRtime]{applyAdjustedRtime()}} function prior to filtering.

Extract a \code{data.frame} of retention time, mz and intensity
values from each file/sample in the provided rt-mz range (or for the full
data range if \code{rt} and \code{mz} are not defined).
}
\examples{
## Read some files from the test data package.
library(faahKO)
library(xcms)
library(magrittr)
fls <- dir(system.file("cdf/KO", package = "faahKO"), recursive = TRUE,
           full.names = TRUE)
raw_data <- readMSData(fls[1:2], mode = "onDisk")

## Extract the full data as a data.frame
ms_all <- as(raw_data, "data.frame")
head(ms_all)
nrow(ms_all)

## Read the full MS data for a defined mz-rt region.
res <- raw_data \%>\%
    filterRt(rt = c(2700, 2900)) \%>\%
    filterMz(mz = c(300, 320)) \%>\%
    as("data.frame")

head(res)
nrow(res)
}
\seealso{
\code{XCMSnExp} for the data object.
}
\author{
Johannes Rainer
}
