View source: R/datelife_search.R
datelife_search | R Documentation |
datelife_search
is the core DateLife function to find and
get all openly available, peer-reviewed scientific information on time of
lineage divergence for a set of input
taxon names given as a character
vector, a newick character string, a phylo
or multiPhylo
object or as a
an already processed datelifeQuery
object obtained with make_datelife_query()
.
datelife_search(
input = c("Rhea americana", "Pterocnemia pennata", "Struthio camelus"),
use_tnrs = FALSE,
get_spp_from_taxon = FALSE,
partial = TRUE,
cache = "opentree_chronograms",
summary_format = "phylo_all",
na_rm = FALSE,
summary_print = c("citations", "taxa"),
taxon_summary = c("none", "summary", "matrix"),
criterion = "taxa"
)
input |
One of the following:
|
use_tnrs |
Whether to use Open Tree of Life's Taxonomic Name Resolution Service (TNRS)
to process input taxon names. Default to |
get_spp_from_taxon |
Whether to search ages for all species belonging to a
given taxon or not. Default to |
partial |
Whether to return or exclude partially matching source chronograms,
i.e, those that match some and not all of taxa given in |
cache |
A character vector of length one, with the name of the data object
to cache. Default to |
summary_format |
A character vector of length one, indicating the output format for results of the DateLife search. Available output formats are:
|
na_rm |
If |
summary_print |
A character vector specifying the type of summary information to be printed to screen. Options are:
Defaults to |
taxon_summary |
A character vector specifying if data on target taxa missing
in source chronograms should be added to the output as a |
criterion |
Defaults to |
If only one taxon name is given as input
, get_spp_from_taxon
is
always set to TRUE
.
The output is determined by the argument summary_format
:
summary_format = "citations"
The function returns a character vector of references.
summary_format = "mrca"
The function returns a named numeric vector of most recent common ancestor (mrca) ages.
summary_format = "newick_[all, sdm, or median]"
The function returns output chronograms as newick strings.
summary_format = "phylo_[all, sdm, median, or biggest]"
The
function returns output chronograms as phylo
or multiPhylo
objects.
summary_format = "html" or "data_frame"
The function returns a 4 column table with data on mrca ages, number of taxa, references, and output chronograms as newick strings.
## Not run:
# For this example, we will set a temp working directory, but you can set
# your working directory as needed:
# we will use the tempdir() function to get a temporary directory:
tempwd <- tempdir()
# Obtain median ages from a set of source chronograms in newick format:
ages <- datelife_search(c(
"Rhea americana", "Pterocnemia pennata", "Struthio camelus",
"Mus musculus"
), summary_format = "newick_median")
# Save the tree in the temp working directory in newick format:
write(ages, file = file.path(tempwd, "some.bird.ages.txt"))
# Obtain median ages from a set of source chronograms in phylo format
# Will produce same tree as above but in "phylo" format:
ages.again <- datelife_search(c(
"Rhea americana", "Pterocnemia pennata", "Struthio camelus",
"Mus musculus"
), summary_format = "phylo_median")
plot(ages.again)
library(ape)
ape::axisPhylo()
mtext("Time (million years ago)", side = 1, line = 2, at = (max(get("last_plot.phylo",
envir = .PlotPhyloEnv
)$xx) * 0.5))
# Save "phylo" object in newick format
write.tree(ages.again, file = file.path(tempwd, "some.bird.tree.again.txt"))
# Obtain MRCA ages and target chronograms from all source chronograms
# Generate an htm"l output readable in any web browser:
ages.html <- datelife_search(c(
"Rhea americana", "Pterocnemia pennata", "Struthio camelus",
"Mus musculus"
), summary_format = "html")
write(ages.html, file = file.path(tempwd, "some.bird.trees.html"))
system(paste("open", file.path(tempwd, "some.bird.trees.html")))
## End(Not run) # end dontrun
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.