reshape: Reshape Species Matrix

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

reshapeSpecies is a utility function for conversion of objects of class "data.frame" to class Species. The format demands cover values for layers to be given in separate columns. Such data structures might be delivered by certain data bases or archives, or are available as digitized field lists. shapeSpecies performs the reverse operation on objects of class Vegsoup*. This might be useful for tabular presentation of single relevées.

Usage

1
2
3
  reshapeSpecies(x, file, schema, sep = ";", dec = ",", verbose = FALSE)

  shapeSpecies(obj)

Arguments

x

A data frame given in a particular structure.

obj

A Vegsoup* object.

file

Path to a csv-file.

schema

Names of columns to be searched for. See ‘Details’.

sep

See read.csv for parsing of csv files. Defaults are set according to read.csv2, also regarding dec!

dec

See read.csv.

verbose

Prints diagnostic messages.

Details

The current implementation for reshapeSpecies support only a single case. The values of schema are seeked in the column names of x, respectively, file to tabulate observations for layers. The first element of schema identifies plots, the second species abbreviations or taxon names, and the remaining columns contain the observations on a specific layer. Layer codes are assigned based on names(x). See ‘Examples’.

shapeSpecies reverts what is done by reshapeSpecies. The main purpose of that function is print a compact and more readable species list including when there are more than one layer.

Value

reshapeSpecies returns an object of class Species.

shapeSpecies returns an object of class "data.frame".

Note

shapeSpecies will change the order of taxa based on taxonomy(obj). The order of plots equals that of the input object. The same is true for the order of layer columns.

Author(s)

Roland Kaiser

See Also

Species, stackSpecies

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# create dummy data
# only a single plot for demonstartion
require(vegsoup)

data(barmstein)
x <- barmstein

# for demonstration, first create format
spc <- shapeSpecies(x)
class(spc)
head(spc)

# then stack again
r <- reshapeSpecies(spc, schema = c("plot", "abbr", "hl", "sl", "ml"))

vegsoup documentation built on Feb. 24, 2021, 3 a.m.