filter_taxa: Expand EPDr objects with new taxa

Description Usage Arguments Value Examples

Description

This function modifies @commdf@counts slot of (epd.entity.df-class objects to filter taxa columns to match taxa. The function adds empty columns (NA) if a new taxa is defined in taxa or removes columns for the taxa not included in taxa. The function may look useless for a single entity but it is useful when standardizing data across multiple entities.

Usage

1
2
3
4
5
6
7
8
9
filter_taxa(x, taxa, epd.taxonomy, na_value = 0)

## S4 method for signature 'epd.entity.df,character,data.frame'
filter_taxa(x, taxa,
  epd.taxonomy, na_value = 0)

## S4 method for signature 'epd.entity,character,data.frame'
filter_taxa(x, taxa, epd.taxonomy,
  na_value = 0)

Arguments

x

epd.entity epd.entity.df-class or epd.entity-class object to be modified.

taxa

character Character vector indicating the new taxa in the @epd.entity.df slot.

epd.taxonomy

data.frame Data frame with the taxonomy from the EPD as from the get_taxonomy_epd function.

na_value

numeric Number indicating the value to be used for taxa not previously present in the entity.

Value

epd.entity.df-class object with the modified @commdf@counts slot.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
epd.connection <- connect_to_epd(host="localhost", database="epd",
                                 user="epdr", password="epdrpw")
epd.1 <- get_entity(1, epd.connection)
epd.1@commdf@taxanames
colnames(epd.1@commdf@counts)
epd.1.ft <- filter_taxa(epd.1, c(epd.1@commdf@taxa_names, "prueba"),
                        get_taxonomy_epd(epd.connection))
colnames(epd.1.ft@commdf@counts)
epd.1.ft@commdf@taxanames
head(epd.1.ft@commdf@counts)

## End(Not run)

dinilu/EPDr documentation built on Aug. 22, 2019, 1:03 p.m.