calculate_cover: Calculate total cover per species in vegetation transects

Description Usage Arguments Value Author(s) Examples

View source: R/calculate_cover.R

Description

Calculate total cover per species in each transect, layer within transect, etc. Optionally, the function can also calculate length of bare ground (as ground not covered by any plant species).

Usage

1
2
3
calculate_cover(df, split.cols, first.spcol, last.spcol = ncol(df), tr.length,
  bare = FALSE, precision, check.incremental = TRUE, sort.cols = TRUE,
  prop = FALSE, long.format = FALSE, show.progress = TRUE)

Arguments

df

A dataframe with one column per recorded species, plus additional columns to identify transects (and possibly sections within transects, shrub or tree layers, etc). For each species, introduce initial and ending distances every time the species appears along the transect (see example).

split.cols

A character vector with the names of the variables in df that identify transects or any other structure of the data (e.g. sections within transects, shrub or tree layers, etc.)

first.spcol

Integer. Number of the first column containing species cover data.

last.spcol

Integer. Number of the last column containing species cover data (last column in df by default).

tr.length

Numeric. Total transect length (e.g. in meters).

bare

Logical. Calculate bare cover? Default is TRUE.

precision

Numeric. Precision of species cover measurements. Only used to calculate bare cover by exclusion.

check.incremental

Logical (default is TRUE). Check that cover data are sorted incrementally? Must be TRUE if calculating bare cover with this function.

sort.cols

Logical. If TRUE (default), sort species columns alphabetically (including bare as a species).

prop

Logical. If TRUE, results are expressed as proportion of tr.length covered by each species. If FALSE (the default), results represent linear absolute length covered by each species.

long.format

Logical. Produce the output dataframe in long format? Default is wide format. See gather.

show.progress

Logical. Show progress bar?

Value

A dataframe with total cover values per species and transect (plus optionally bare ground).

Author(s)

F Rodriguez-Sanchez

Examples

1
2
3
4
5
6
7
8
9
df <- data.frame(transect = sort(rep(c(1,2,3), 20)),
                 section = rep(1, 60),
                 species1 = c(replicate(3, sort(round(runif(20, 0, 100), digits = 1)))),
                 species2 = c(sort(round(runif(8, 0, 100), digits = 1)), rep(NA, times = 60 - 8)))
head(df)
calculate_cover(df, split.cols = "transect", first.spcol = 3,
tr.length = 100, check.incremental = FALSE)
calculate_cover(df, split.cols = "transect", first.spcol = 3, tr.length = 100,
check.incremental = FALSE, long.format = TRUE)

Pakillo/vegetools documentation built on Sept. 12, 2020, 10:31 a.m.