Conversion of a data frame containing a cross table of abundance or cover of species in single plots.
This function coerces a data frame containing a vegetation cross table into
a vegtable object. The input data frame x
may include information
on the layers or not.
Usage
df2vegtable(x, species, layer, ...)
# S4 method for class 'data.frame,numeric,numeric'
df2vegtable(x, species, layer, ...)
# S4 method for class 'data.frame,numeric,missing'
df2vegtable(x, species, layer, ...)
Value
A vegtable object.
Author
Miguel Alvarez kamapu78@gmail.com
Examples
## Creating data set 'dune_veg'
library(vegan)
#> Loading required package: permute
#> Loading required package: lattice
#> This is vegan 2.6-6.1
## Load data from vegan
data(dune)
data(dune.env)
## Conversion to vegtable
dune_veg <- data.frame(
species = colnames(dune), t(dune),
stringsAsFactors = FALSE, check.names = FALSE
)
dune_veg <- df2vegtable(dune_veg, species = 1)
summary(dune_veg)
#> ## Metadata
#> object size: 24.9 Kb
#> validity: TRUE
#>
#> ## Content
#> number of plots: 20
#> plots with records: 20
#> variables in header: 1
#> number of relations: 0
#>
#> ## Taxonomic List
#> taxon names: 30
#> taxon concepts: 30
#> validity: TRUE
#>
## Adding environmental variables
dune.env$ReleveID <- as.integer(rownames(dune.env))
header(dune_veg) <- dune.env
summary(dune_veg)
#> ## Metadata
#> object size: 28.9 Kb
#> validity: TRUE
#>
#> ## Content
#> number of plots: 20
#> plots with records: 20
#> variables in header: 6
#> number of relations: 0
#>
#> ## Taxonomic List
#> taxon names: 30
#> taxon concepts: 30
#> validity: TRUE
#>