table_by_taxa_age: Tabulate counts by taxa and age

Description Usage Arguments Value Examples

Description

This function tabulates data from the @commdf@counts slot in EPDr objects (epd.entity.df-class or calculated them from a epd.entity-class) to summarize information for particular taxa at particular age or time intervals (samples). This function is useful to reshape the data to be plotted and mapped by link[ggplot2]{ggplot}. It was written to be used by map_taxa_age function.

Usage

1
2
3
4
5
6
7
8
9
table_by_taxa_age(x, taxa, sample_label)

## S4 method for signature 'epd.entity.df,character,character'
table_by_taxa_age(x, taxa,
  sample_label)

## S4 method for signature 'epd.entity,character,character'
table_by_taxa_age(x, taxa,
  sample_label)

Arguments

x

epd.entity.df epd.entity.df-class object where to extract the data from, or a epd.entity-class that is automatically transformed into a epd.entity.df-class and then tabulated.

taxa

character Character vector indicating the taxa to be included in the table. Several taxa can be specified but the function returns data for only one taxa by summing all counts, and the taxa name specified in the output is the first one in taxa. This is useful when you want to combine data from different taxa in the same genus, for instance.

sample_label

character Character vector indicating the ages or time intervals to be included in the table.

Value

Data frame with six columns: e_, londd, latdd, count, sample_label, and taxa_label.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
epd.connection <- connect_to_epd(host = "localhost", database = "epd",
                               user = "epdr", password = "epdrpw")
epd.1 <- get_entity(1, epd.connection)
epd.1 <- filter_taxagroups(epd.1, c("HERB", "TRSH", "DWAR",
                                      "LIAN", "HEMI", "UPHE"))
epd.1 <- giesecke_default_chron(epd.1)

epd.1 <- interpolate_counts(epd.1, seq(0, 22000, by = 1000))
epd.taxonomy <- getTaxonomyEPD(epd.connection)
epd.1 <- taxa_to_acceptedtaxa(epd.1, epd.taxonomy)

table_by_taxa_age(epd.1, "Cedrus", 
                  as.character(seq(0, 21000, by=1000)))

## End(Not run)

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