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

tdata-methods

Retrieving or updating tip and node data in phylo4d objects


Description

Methods to retrieve or update tip, node or all data associated with a phylogenetic tree stored as a phylo4d object

Usage

tdata(x, ...)

## S4 method for signature 'phylo4d'
tdata(
  x,
  type = c("all", "tip", "internal"),
  label.type = c("row.names", "column"),
  empty.columns = TRUE
)

tdata(x, ...) <- value

## S4 replacement method for signature 'phylo4d'
tdata(
  x,
  type = c("all", "tip", "internal"),
  merge.data = TRUE,
  clear.all = FALSE,
  ...
) <- value

tipData(x, ...)

## S4 method for signature 'phylo4d'
tipData(x, ...)

tipData(x, ...) <- value

## S4 replacement method for signature 'phylo4d'
tipData(x, ...) <- value

nodeData(x, ...)

## S4 method for signature 'phylo4d'
nodeData(x, ...)

nodeData(x, ...) <- value

## S4 replacement method for signature 'phylo4d'
nodeData(x, ...) <- value

Arguments

x

A phylo4d object

...

For the tipData and nodeData accessors, further arguments to be used by tdata. For the replacement forms, further arguments to be used to control matching between tree and data (see Details section of phylo4d-methods).

type

The type of data to retrieve or update: “all” (default) for data associated with both tip and internal nodes, “tip” for data associated with tips only, “internal” for data associated with internal nodes only.

label.type

How should the tip/node labels from the tree be returned? “row.names” returns them as row names of the data frame, “column” returns them in the first column of the data frame. This options is useful in the case of missing (NA) or non-unique labels.

empty.columns

Should columns filled with NA be returned?

value

a data frame (or object to be coerced to one) to replace the values associated with the nodes specified by the argument type

merge.data

if tip or internal node data are provided and data already exists for the other type, this determines whether columns with common names will be merged together (default TRUE). If FALSE, columns with common names will be preserved separately, with “.tip” and “.node” appended to the names. This argument has no effect if tip and node data have no column names in common, or if type=“all”.

clear.all

If only tip or internal node data are to be replaced, should data of the other type be dropped?

Value

tdata returns a data frame

Methods

tdata

signature(object="phylo4d"): retrieve or update data associated with a tree in a phylo4d object

Author(s)

Ben Bolker, Thibaut Jombart, Francois Michonneau

See Also

Examples

data(geospiza)
   tdata(geospiza)
   tipData(geospiza) <- 1:nTips(geospiza)
   tdata(geospiza)

phylobase

Base Package for Phylogenetic Structures and Comparative Data

v0.8.10
GPL (>= 2)
Authors
R Hackathon et al. (alphabetically: Ben Bolker, Marguerite Butler, Peter Cowan, Damien de Vienne, Dirk Eddelbuettel, Mark Holder, Thibaut Jombart, Steve Kembel, Francois Michonneau, David Orme, Brian O'Meara, Emmanuel Paradis, Jim Regetz, Derrick Zwickl)
Initial release

We don't support your browser anymore

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