Learn R Programming

HMPTrees (version 1.4)

trimToTaxaLevel: Trim a Tree to a Given Level

Description

This function will take a tree and either remove all nodes lower than the given level or will remove all nodes not of the given level.

Usage

trimToTaxaLevel(data, level = "genus", eliminateParentNodes = FALSE, 
		trimBelow = NULL, split = ".")

Arguments

data

A data frame in which each column contains the rdp read counts for every taxa given in the row names.

level

The depth the tree will go down to (kingdom, phylum, class, order, family, genus, species, subspecies).

eliminateParentNodes

If 'TRUE' the data set returned will only contain rows at the level specified by 'myTaxaLevel'. If 'FALSE' the data set returned will contain all the nodes up to the level specified by 'myTaxaLevel'.

trimBelow

If 'NULL' the function will pull out only the data at the level specified by 'myTaxaLevel'. If 'TRUE' the function will remove all the levels below the specified level. If 'FALSE' the function will remove all the levels above the specified level.

split

This is the character that separates the taxa levels in the row names.

Value

A new data set that has been trimmed to the level selected.

Details

Notes:

  1. For 'level' k, p, c, o, f, g, s and ss can be used in place of kingdom, phylum, class, order, family, genus, species and subspecies respectively.

  2. Numbers can also be used for 'level', with no maximum limit.

  3. The option to 'eliminateParentNodes' only works when 'trimBelow' is NULL.

Examples

Run this code
	data(saliva)
	
	### Trims saliva to only contain the class level 
	salivaClass <- trimToTaxaLevel(saliva, "class", TRUE)

Run the code above in your browser using DataLab