1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/uniquifyDataFrameByGroup.R
\name{uniquifyDataFrameByGroup}
\alias{uniquifyDataFrameByGroup}
\title{Groupwise unique rows of a DataFrame}
\usage{
uniquifyDataFrameByGroup(x, grouping)
}
\arguments{
\item{x}{A \linkS4class{DFrame}.}
\item{grouping}{A factor (or a vector coercible into a factor) of length equal to \code{nrow(x)},
containing the groupings for each row of \code{x}.}
}
\value{
A \linkS4class{DFrame} where each row corresponds to a level of \code{grouping}.
Each column corresponds to a column of \code{x} and contains the unique value for each group, or \code{NA} if no such value exists.
}
\description{
Obtain unique values for groups of rows in a \linkS4class{DataFrame}.
This is used by \code{\link{aggregateAcrossCells}} to obtain \code{\link{colData}} for the aggregated SummarizedExperiment.
}
\examples{
x <- DataFrame(
foo = rep(LETTERS[1:3], 10),
bar = rep(letters[1:3], 10),
val = sample(3, 30, replace=TRUE)
)
uniquifyDataFrameByGroup(x, x$foo)
uniquifyDataFrameByGroup(x, x$val)
}
\author{
Aaron Lun
}
|