man/subset.Rd
fe1e4505
 % Generated by roxygen2: do not edit by hand
4574c875
 % Please edit documentation in R/qtle_subset.R
fe1e4505
 \docType{methods}
4574c875
 \name{QTLe-subset}
 \alias{QTLe-subset}
 \alias{[,QTLExperiment,ANY-method}
 \alias{[,QTLExperiment,ANY,ANY-method}
 \alias{[,QTLExperiment,ANY,ANY,ANY-method}
 \alias{[<-,QTLExperiment,ANY,ANY,QTLExperiment-method}
d1424c3b
 \alias{subset,QTLExperiment-method}
4574c875
 \title{Subsetting and replacing data in QTLExperiment objects}
d1424c3b
 \usage{
aeee5fea
 \S4method{subset}{QTLExperiment}(x, i, ...)
 }
 \arguments{
 \item{x}{is a \linkS4class{QTLExperiment} object}
 
 \item{i}{is a vector of subscripts indicating the rows to retain.}
 
 \item{...}{Further arguments to the \code{subset} function are passed to \code{S4Vectors:::evalqForSubset}.}
d1424c3b
 }
1f0383da
 \value{
 A \linkS4class{QTLExperiment} object.
 }
fe1e4505
 \description{
4574c875
 Includes methods to subset a \linkS4class{QTLExperiment} object by
1627974e
 row and/or column and methods to replace all data for the specified rows
 and/or columns with another value. These methods ensure that all data fields
 remain synchronized when states or associations are removed.
aeee5fea
 The \linkS4class{QTLExperiment} object is compatible with subsetting using 
 square brackets or with the \code{subset} function.
fe1e4505
 }
 \section{Subsetting}{
 
4574c875
 In the following, \code{x} is a \linkS4class{QTLExperiment} object.
fe1e4505
 
 \describe{
4574c875
 \item{\code{x[i, j, ..., drop=TRUE]}:}{Returns a QTLExperiment
fe1e4505
  containing the specified rows \code{i} and columns \code{j}, where \code{i}
  and \code{j} can be a logical, integer or character vector of subscripts,
1627974e
  indicating the rows and columns, respectively, to retain. If either \code{i}
  or \code{j} is missing, than subsetting is only performed in the specified
  dimension. Arguments in \code{...} and \code{drop} are passed to
aeee5fea
  \code{\link[SummarizedExperiment]{[,SummarizedExperiment-method}}.}
fe1e4505
 }
 }
 
 \section{Replacing}{
 
4574c875
 In the following, \code{x} is a \linkS4class{QTLExperiment} object.
fe1e4505
 
 \describe{
 \item{\code{x[i, j, ...] <- value}:}{Replaces all data for rows \code{i} and
be7a2f01
 columns \code{j} with the corresponding fields in a QTLExperiment
fe1e4505
 \code{value}, where \code{i} and \code{j} can be a logical, integer, or
 character vector of subscripts, indicating the rows and columns,
1627974e
 respectively, to retain. If either \code{i} or \code{j} is missing, than
 subsetting is only performed in the specified dimension. If both are missing,
 \code{x} is replaced entirely with \code{value}. Arguments in \code{...} are
 passed to the corresponding \linkS4class{SummarizedExperiment} method.}
fe1e4505
 }
 }
 
 \examples{
4574c875
 qtle <- mockQTLE()
fe1e4505
 
 # Subsetting:
4574c875
 qtle[1:10,]
 qtle[,1:5]
fe1e4505
 
 # Can also use subset()
4574c875
 qtle$WHEE <- sample(c("A", "B", "C"), ncol(qtle), replace=TRUE)
 subset(qtle, , WHEE=="A")
fe1e4505
 
 # Can also use split()
4574c875
 split(qtle, sample(c("A", "B", "C"), nrow(qtle), replace=TRUE))
fe1e4505
 
 }
 \author{
 Christina B Azodi
 }