View source: R/old_taxa--taxmap--s3.R
arrange_obs | R Documentation |
Sort rows of tables or the elements of lists/vectors in the 'obj$data' list in [taxmap()] objects. Any variable name that appears in [all_names()] can be used as if it was a vector on its own. See [dplyr::arrange()] for the inspiration for this function and more information. Calling the function using the 'obj$arrange_obs(...)' style edits "obj" in place, unlike most R functions. However, calling the function using the 'arrange_obs(obj, ...)' imitates R's traditional copy-on-modify semantics, so "obj" would not be changed; instead a changed version would be returned, like most R functions.
obj$arrange_obs(data, ...) arrange_obs(obj, data, ...)
obj |
An object of type [taxmap()]. |
data |
Dataset names, indexes, or a logical vector that indicates which datasets in 'obj$data' to sort If multiple datasets are sorted at once, then they must be the same length. |
... |
One or more expressions (e.g. column names) to sort on. |
target |
DEPRECIATED. use "data" instead. |
An object of type [taxmap()]
Other taxmap manipulation functions:
arrange_taxa()
,
filter_obs()
,
filter_taxa()
,
mutate_obs()
,
sample_frac_obs()
,
sample_frac_taxa()
,
sample_n_obs()
,
sample_n_taxa()
,
select_obs()
,
transmute_obs()
# Sort in ascending order
arrange_obs(ex_taxmap, "info", n_legs)
arrange_obs(ex_taxmap, "foods", name)
# Sort in decending order
arrange_obs(ex_taxmap, "info", desc(n_legs))
# Sort multiple datasets at once
arrange_obs(ex_taxmap, c("info", "phylopic_ids", "foods"), n_legs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.