Description Usage Arguments Value Examples
Values accumulate from the bottom of the ontology to the top at each node, and are computed only from the values of the direct children of each node.
1 2 | compute_hierarchical(df, fun, compute_column, result_column,
include_node = FALSE, na.rm = NULL, taxon_column = "taxons")
|
df |
A flat ontology data.frame with a taxons column |
fun |
The function to run as a character object, e.g. "mean". |
compute_column |
The column of values to use for the function computation. |
result_column |
The name of the output column. |
include_node |
Logical, should values assigned to non-leaf nodes be included in calculation? |
na.rm |
If TRUE or FALSE, passed as a parameter to fun. If NULL (default), is ignored. |
taxon_column |
The name of the taxons column. Default is "taxons" |
A flat ontology data.frame with the result_column added. The taxon column will be moved to the last column position. This should behave similarly to mutate().
1 2 3 | flat_ontology2 <- flat_ontology %>%
compute_hierarchical("mean","n_children","mean_children",
include_node = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.