View source: R/uniquifyDataFrameByGroup.R
uniquifyDataFrameByGroup | R Documentation |
Obtain unique values for groups of rows in a DataFrame.
This is used by aggregateAcrossCells
to obtain colData
for the aggregated SummarizedExperiment.
uniquifyDataFrameByGroup(x, grouping)
x |
A DFrame. |
grouping |
A factor (or a vector coercible into a factor) of length equal to |
A DFrame where each row corresponds to a level of grouping
.
Each column corresponds to a column of x
and contains the unique value for each group, or NA
if no such value exists.
Aaron Lun
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.