View source: R/move_nested_labels.R
move_nested_labels | R Documentation |
Moves a nested factor level in a fantaxtic psmelt dataframe to the desired position.
move_nested_labels(
psdf,
top_level,
nested_level,
top_merged_label = "Other",
nested_label = "Other",
pos = Inf
)
psdf |
A psmelt dataframe |
top_level |
The name of the top level factor column |
nested_level |
The name of the nested level factor column |
top_merged_label |
The label for the top level merged taxon |
nested_label |
The nested label to be moved |
pos |
The position to move the level to. |
A data.frame
data(GlobalPatterns)
# Move "Other" to position Inf
top <- nested_top_taxa(GlobalPatterns, top_tax_level = "Phylum", nested_tax_level = "Species", n_top_taxa = 3, n_nested_taxa = 3)
psdf <- psmelt(top$ps_obj)
psdf <- move_label(psdf, col_name = "Phylum", label = "Other", pos = 0)
psdf <- move_nested_labels(psdf, top_level = "Phylum", nested_level = "Species", pos = Inf)
levels(psdf$Species)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.