remove_agg_if_in_child: Remove aggregated quantity if it exists in a child node

Description Usage Arguments Value Examples

View source: R/tree_funs.r

Description

Idea is that you can aggregate a property up a tree (taxon id), then prune the tree, then apply this function to end up with taxons that were originally on pruned nodes, on their closest unpruned parent

Usage

1
remove_agg_if_in_child(node, property)

Arguments

node

data.tree node, where a quantity has been aggregated using 'list_up_tree'()

property

name of the property which was originally aggregated (i.e. same char vector you passed to 'list_up_tree'())

Value

a tree where the aggregated field no longer contains ids if they are elsewhere in the tree

Examples

1
2
3
4
5
6
7
8
### Aggregate some property
list_up_tree(node = taxonomy_tree, property = "name")

### Prune tree
data.tree::Prune(taxonomy_tree, function(x) x$n_pages_agg >= threshold)

### remove properties from the aggregate if they are still in the tree
remove_agg_if_in_child(node = taxonomy_tree, property = "name")

mattmalcher/gov.uk.taxonomy documentation built on Jan. 25, 2020, 12:45 a.m.