Learn R Programming

fgeo.analyze (version 1.1.14)

fgeo_habitat: Create habitat data from measures of topography.

Description

This function constructs habitat data based on elevation data. It calculates habitats in two steps:

  1. It calculates mean elevation, convexity and slope for each quadrat.

  2. It calculates habitats based on hierarchical clustering of the topographic metrics from step 1.

Usage

fgeo_habitat(elev, gridsize, n, ...)

Arguments

elev

One of these:

  • A dataframe containing elevation data, with columns gx, gy, and elev, or x, y, and elev (e.g. fgeo.x::elevation$col).

  • A ForestGEO-like elevation list with elements xdim and ydim giving plot dimensions, and element col containing a dataframe as described in the previous item (e.g. fgeo.x::elevation).

gridsize

Number giving the size of each quadrat for which a habitat is calculated. Commonly, gridsize = 20.

n

Integer. Number of cluster-groups to construct (passed to the argument k to stats::cutree()).

...

Arguments passed to fgeo_topography().

Value

A dataframe of subclass fgeo_habitat, with columns gx and gy, rounded with accuracy determined by gridsize, and column habitats, with as many distinct integer values as determined by the argument n.

See Also

fgeo.plot::autoplot.fgeo_habitat(), fgeo_topography().

Other habitat functions: fgeo_topography(), tt_test()

Other functions to construct fgeo classes: fgeo_topography()

Examples

Run this code
# NOT RUN {
assert_is_installed("fgeo.x")

# Input a ForestGEO-like elevation list or dataframe
elevation_ls <- fgeo.x::elevation
habitats <- fgeo_habitat(
  elevation_ls,
  gridsize = 20, n = 4
)

str(habitats)

# Habitat data is useful for calculating species-habitat associations
census <- fgeo.x::tree6_3species
as_tibble(
  tt_test(census, habitats)
)
# }

Run the code above in your browser using DataLab