Description Usage Arguments Value Author(s) Examples
csubset
creates a subset of a count matrix, based on identity
of column phenotypes to a specified value.
1 |
val |
|
x |
A matrix of counts, with rows corresponding to samples and columns to taxonomic groups. |
pheno |
A |
cidx |
A |
A matrix
of counts, with rows satisfying pheno %in%
val
and with columns equal either to ncol(x)
(when
cidx=TRUE
) or the number of columns with non-zero counts after
row subsetting (cidx=FALSE
).
Martin Morgan mailto:mtmorgan@fhcrc.org
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## count matrix
fl <- system.file(package="DirichletMultinomial", "extdata",
"Twins.csv")
count <- t(as.matrix(read.csv(fl, row.names=1)))
## phenotype
fl <- system.file(package="DirichletMultinomial", "extdata",
"TwinStudy.t")
pheno0 <- scan(fl)
lvls <- c("Lean", "Obese", "Overwt")
pheno <- factor(lvls[pheno0 + 1], levels=lvls)
names(pheno) <- rownames(count)
## subset
dim(count)
sum("Lean" == pheno)
dim(csubset("Lean", count, pheno))
dim(csubset("Lean", count, pheno, cidx=FALSE))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.