R: Aggregate data by given taxonomic rank

rankagg {taxize} | R Documentation

## Aggregate data by given taxonomic rank

### Description

Aggregate data by given taxonomic rank

### Usage

    rankagg(data = NULL, datacol = NULL, rank = NULL, fxn = "sum")

### Arguments

`data` | A data.frame. Column headers must have capitalized ranks (e.g., Genus, Tribe, etc.) (data.frame)
`datacol` | The data column (character)
`rank` | Taxonomic rank to aggregate by (character)
`fxn` | Arithmetic function or vector or functions (character)

### Examples

    library("vegan")
    data(dune.taxon, package='vegan')
    dat <- dune.taxon
    set.seed(1234)
    dat$abundance <- round(rlnorm(n=nrow(dat),meanlog=5,sdlog=2),0)
    rankagg(data=dat, datacol="abundance", rank="Genus")
    rankagg(data=dat, "abundance", rank="Family")
    rankagg(data=dat, "abundance", rank="Genus", fxn="mean")
    rankagg(data=dat, "abundance", rank="Subclass")
    rankagg(data=dat, "abundance", rank="Subclass", fxn="sd")

[Package taxize version 0.9.0 Index]