clean.data: Cleaning phylogenetic data

View source: R/clean.data.R

clean.dataR Documentation

Cleaning phylogenetic data

Description

Cleans a table/tree to match with a given table/tree

Usage

clean.data(data, tree, data.col = FALSE)

Arguments

data

A data.frame or matrix with the elements names as row names.

tree

A phylo or multiPhylo object.

data.col

Optional, the number (numeric) or name (character) of the column in data that contains the tip labels to match. If left missing, the data's rownames are used (default is FALSE).

Value

A list containing the cleaned data and tree(s) and information on the eventual dropped tips and rows.

Author(s)

Thomas Guillerme

Examples

##Creating a set of different trees
trees_list <- list(rtree(5, tip.label = LETTERS[1:5]), rtree(4,
     tip.label = LETTERS[1:4]), rtree(6, tip.label = LETTERS[1:6]))
class(trees_list) <- "multiPhylo"

##Creating a matrix
dummy_data <- matrix(c(rnorm(5), runif(5)), 5, 2,
    dimnames = list(LETTERS[1:5], c("var1", "var2")))

##Cleaning the trees and the data
cleaned <- clean.data(data = dummy_data, tree = trees_list)
##The taxa that where dropped (tips and rows):
c(cleaned$dropped_tips, cleaned$dropped_rows)
##The cleaned trees:
cleaned$tree
##The cleaned data set:
cleaned$data


TGuillerme/mulTree documentation built on Feb. 21, 2024, 9:18 a.m.