mostAbundant | R Documentation |
Return a subset of an input matrix or data frame, containing only the N most abundant rows (or columns), sorted. Alternatively, a custom set of rows can be returned.
mostAbundant(
data,
N = 10,
items = NULL,
others = FALSE,
rescale = FALSE,
bycol = FALSE
)
data |
numeric matrix or data frame |
N |
integer Number of rows to return (default |
items |
Character vector. Custom row names to return. If provided, it will override |
others |
logical. If |
rescale |
logical. Scale result to percentages column-wise (default |
bycol |
logical. Operate on columns instead of rows (default |
A matrix or data frame (same as input) with the selected rows (or columns).
data(Hadza)
Hadza.carb = subsetFun(Hadza, "Carbohydrate metabolism")
# Which are the 20 most abundant KEGG functions in the ORFs related to carbohydrate metabolism?
topCarb = mostAbundant(Hadza.carb$functions$KEGG$tpm, N=20)
# Now print them with nice names.
rownames(topCarb) = paste(rownames(topCarb),
Hadza.carb$misc$KEGG_names[rownames(topCarb)], sep="; ")
topCarb
# We can pass this to any R function.
heatmap(topCarb)
# But for convenience we provide wrappers for plotting ggplot2 heatmaps and barplots.
plotHeatmap(topCarb, label_y="TPM")
plotBars(topCarb, label_y="TPM")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.