Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

get_study

Get all the trees associated with a particular study


Description

Returns the trees associated with a given study

Usage

get_study(
  study_id = NULL,
  object_format = c("phylo", "nexml"),
  file_format,
  file,
  ...
)

Arguments

study_id

the study ID for the study of interest (character)

object_format

the class of the object the query should return (either phylo or nexml). Ignored if file_format is specified.

file_format

the format of the file to be generated (newick, nexus, nexml or json).

file

the file name where the output of the function will be saved.

...

additional arguments to customize the API request (see rotl package documentation).

Details

If file_format is missing, the function returns an object of the class phylo from the ape package (default), or an object of the class nexml from the RNeXML package.

Otherwise file_format can be either newick, nexus, nexml or json, and the function will generate a file of the selected format. In this case, a file name needs to be provided using the argument file. If a file with the same name already exists, it will be silently overwritten.

Value

if file_format is missing, an object of class phylo or nexml, otherwise a logical indicating whether the file was successfully created.

See Also

Examples

## Not run: 
that_one_study <- get_study(study_id="pg_719", object_format="phylo")
if (require(RNeXML)) { ## if RNeXML is installed get the object directly
   nexml_study <- get_study(study_id="pg_719", object_format="nexml")
} else { ## otherwise write it to a file
   get_study(study_id="pg_719", file_format="nexml", file=tempfile(fileext=".nexml"))
}

## End(Not run)

rotl

Interface to the 'Open Tree of Life' API

v3.0.11
BSD_2_clause + file LICENSE
Authors
Francois Michonneau [aut, cre] (<https://orcid.org/0000-0002-9092-966X>), Joseph Brown [aut] (<https://orcid.org/0000-0002-3835-8062>), David Winter [aut] (<https://orcid.org/0000-0002-6165-0029>), Scott Chamberlain [rev] (<https://orcid.org/0000-0003-1444-9135>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.