obs

0th

Percentile

Get data indexes associated with taxa

Given a taxmap() object, return data associated with each taxon in a given table included in that taxmap() object.

obj$obs(data, value = NULL, subset = NULL,
  recursive = TRUE, simplify = FALSE)
obs(obj, data, value = NULL, subset = NULL,
  recursive = TRUE, simplify = FALSE)

Arguments
obj

(taxmap()) The taxmap() object containing taxon information to be queried.

data

Either the name of something in obj$data that has taxon information or a an external object with taxon information. For tables, there must be a column named "taxon_id" and lists/vectors must be named by taxon ID.

value

What data to return. This is usually the name of column in a table in obj$data. Any result of all_names(obj) can be used. If the value used has names, it is assumed that the names are taxon ids and the taxon ids are used to look up the correct values.

subset

(character) Taxon IDs or indexes for which observation indexes will be returned. Default: All taxa in obj will be used.

recursive

(logical or numeric) If FALSE, only return the observation assigned to the specified input taxa, not subtaxa. If TRUE, return all the observations of every subtaxa, etc. Positive numbers indicate the number of ranks below the each taxon to get observations for 0 is equivalent to FALSE. Negative numbers are equivalent to TRUE.

simplify

(logical) If TRUE, then combine all the results into a single vector of unique observation indexes.

Value

If simplify = FALSE, then a list of vectors of observation indexes are returned corresponding to the target argument. If simplify = TRUE, then the observation indexes for all target taxa are returned in a single vector.

Aliases
  • obs
Examples
# NOT RUN {
# Get indexes of rows corresponding to each taxon
obs(ex_taxmap, "info")

# Get only a subset of taxon indexes
obs(ex_taxmap, "info", subset = 1:2)

# Get only a subset of taxon IDs
obs(ex_taxmap, "info", subset = c("1", "2"))

# Get only a subset of taxa using logical tests
obs(ex_taxmap, "info", subset = taxon_ranks == "genus")

# Only return indexes of rows assinged to each taxon explicitly
obs(ex_taxmap, "info", recursive = FALSE)

# Lump all row indexes in a single vector
obs(ex_taxmap, "info", simplify = TRUE)

# Return values from a dataset instead of indexes
obs(ex_taxmap, "info", value = "name")

# }
Documentation reproduced from package taxa, version 0.1.0, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.