# taxonomic_sample

0th

Percentile

##### Recursivly sample a set of taxonomic assignments

Recursivly sample a set of observations with taxonomic assignments and an associated taxonomy.

##### Usage
taxonomic_sample(taxmap_data, max_counts = c(), min_counts = c(), max_children = c(), min_children = c(), obs_filters = list(), subtaxa_filters = list(), stop_conditions = list(), ...)
##### Arguments
taxmap_data
(An object of type taxmap)
max_counts
(numeric) A named vector that defines that maximum number of observations in for each level specified. The names of the vector specifies that level each number applies to. If more than the maximum number of observations exist for a given taxon, it is randomly subsampled to this number.
min_counts
(numeric) A named vector that defines that minimum number of observations in for each level specified. The names of the vector specifies that level each number applies to.
max_children
(numeric) A named vector that defines that maximum number of subtaxa per taxon for each level specified. The names of the vector specifies that level each number applies to. If more than the maximum number of subtaxa exist for a given taxon, they are randomly subsampled to this number of subtaxa.
min_children
(numeric) A named vector that defines that minimum number of subtaxa in for each level specified. The names of the vector specifies that level each number applies to.
obs_filters
(list of function(observations, id)) A list of functions that take a data structure containing the information of multiple observations and a taxon id. Returns a object of the same type with some of the observations potentially removed.
subtaxa_filters
(list of function(observations, id)) A list of functions that take a data structure containing the information of multiple subtaxa IDs and the current taxon id. Returns a object of the same type with some of the subtaxa potentially removed. If a function returns NULL, then no observations for the current taxon are returned.
stop_conditions
(list of function(id)) A list of functions that take the current taxon id. If any of the functions return TRUE, the observations for the current taxon are returned rather than looking for observations of subtaxa, stopping the recursion.
...
Additional parameters are passed to all of the function options.
##### Value

Returns an object of type taxmap

##### Aliases
• taxonomic_sample
##### Examples

## Not run:
# #Plot data before subsampling
# heat_tree(unite_ex_data_3,
#           node_size = n_obs,
#           node_color = n_obs,
#           node_label = n_obs)
#
# # Subsampling
# subsampled <- taxonomic_sample(unite_ex_data_3,
#                                max_counts = c("4" = 20, "7" = 5),
#                                min_counts = c("7" = 3))
#
# # Remove unobserved taxa and plot
# heat_tree(subset(subsampled, n_obs > 0, unobserved = FALSE),
#           node_size = n_obs,
#           node_color = n_obs,
#           node_label = n_obs)
# ## End(Not run)


Documentation reproduced from package metacoder, version 0.1.2, License: GPL-2 | GPL-3

### Community examples

Looks like there are no examples yet.