species: Methods to Retrieve or Manipulate Slot Species of 'Vegsoup*'...

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

Description

Accessor method to retrieve the species data in long format as stored as class inside the object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## S4 method for signature 'Vegsoup'
species(obj)
## S4 replacement method for signature 'Vegsoup,Species'
species(obj) <- value
## S4 replacement method for signature 'Vegsoup,SpeciesTaxonomy'
species(obj) <- value
## S4 replacement method for signature 'Vegsoup,data.frame'
species(obj) <- value
## S4 replacement method for signature 'Species,data.frame'
species(obj) <- value

Arguments

obj

A Vegsoup* object.

value

Not yet implemented.

Details

Merely a set of accessor and replacement methods for slot 'Species' of Vegsoup objects. The "species<-" method for value class Species can be used to take a subset based on slot 'Species' (see ‘Examples’). Note, this method works only for subsetting an object and you can't add new species observations by this method. The "SpeciesTaxonomy" replacement is needed in such circumstances. In either case, the value object can't add any plots that not already exist (those returned by rownames(obj)). However, changes in the taxonomy component (an addition of new species) can be achieved using this replacement method. The "data.frame" exists for completeness, but is currently not implemented.

The "species<-" method for value class "data.frame" allows for the manipulation (replacement) of the 'abbr' column, e.g for cases where there are no valid strings that match a refernce list. value has to be a data.frame with two columns named "abbr" and "taxon". The elements of taxon have to match column abbr in obj, these will be replaced by column abbr of the value object.

Value

Species object or a subset of the input object depending on value.

Author(s)

Roland Kaiser

See Also

Vegsoup

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require(vegsoup)

data(barmstein)
x <-  barmstein

# retrieve data.frame from an Vegsoup object
spc <- species(x)
class(spc)
barplot(table(spc$cov))

# this is the number of all species observations over all plots and strata
n <- nrow(species(species(x)))

# a random sample
i <- sort(sample(n, 10))

# note, we (might) lose a plot, for sure we only get a subset of species
richness(x)
species(x)[i, ]

# now assign to Vegsoup object
species(x) <- species(x)[i, ]
richness(x)

# subset Vegsoup object by Species object
x <- y<- barmstein
n <- nrow(species(x))
# random subsample of 10 % of all recorded occurences
species(y) <- species(x)[sample(1:n, ceiling(n * 0.1))]

dim(x)
dim(y)

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