Count observations for each taxon in a data set in a taxmap() object. This includes observations for the specific taxon but NOT the observations of its subtaxa. "Observations" in this sense are the items (for list/vectors) or rows (for tables) in a dataset. By default, observations in the first data set in the taxmap() object is used. For example, if the data set is a table, then a value of 3 for a taxon means that their are 3 rows in that table assigned to that taxon.

obj$n_obs_1(data)
n_obs_1(obj, data)

Arguments

obj

(taxmap())

data

Dataset name, index, or a logical vector that indicates which dataset in obj$data to add columns to.

target

DEPRECIATED. use "data" instead.

Value

numeric

See also

Other taxmap data functions: n_obs()

Examples

# Get number of observations for each taxon in first dataset n_obs_1(ex_taxmap)
#> b c d e f g h i j k l m n o p q r #> 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1
# Get number of observations in a specified data set n_obs_1(ex_taxmap, "info")
#> b c d e f g h i j k l m n o p q r #> 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1
n_obs_1(ex_taxmap, "abund")
#> b c d e f g h i j k l m n o p q r #> 0 0 0 0 0 0 0 0 0 0 0 2 2 2 2 0 0
# Filter taxa using number of observations in the first table filter_taxa(ex_taxmap, n_obs_1 > 0)
#> <Taxmap> #> 6 taxa: m. tigris, n. catus ... q. lycopersicum, r. tuberosum #> 6 edges: NA->m, NA->n, NA->o, NA->p, NA->q, NA->r #> 4 data sets: #> info: #> # A tibble: 6 x 4 #> taxon_id name n_legs dangerous #> <chr> <chr> <dbl> <lgl> #> 1 m tiger 4 TRUE #> 2 n cat 4 FALSE #> 3 o mole 4 FALSE #> # … with 3 more rows #> phylopic_ids: a named vector of 'character' with 6 items #> m. e148eabb-f138-43[truncated] ... r. 63604565-0406-46[truncated] #> foods: a list of 6 items named by taxa: #> m, n, o, p, q, r #> abund: #> # A tibble: 8 x 5 #> taxon_id code sample_id count taxon_index #> <chr> <fct> <fct> <dbl> <int> #> 1 m T A 1 1 #> 2 n C A 2 2 #> 3 o M B 5 3 #> # … with 5 more rows #> 1 functions: #> reaction