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.

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()

Author

Richard Condit.

Examples

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)
#> tibble [400 × 3] (S3: fgeo_habitat/fgeo_topography/tbl_df/tbl/data.frame) #> $ gx : num [1:400] 0 0 0 0 0 0 0 0 0 0 ... #> $ gy : num [1:400] 0 20 40 60 80 100 120 140 160 180 ... #> $ habitats: int [1:400] 1 1 1 1 1 1 1 1 1 1 ...
# Habitat data is useful for calculating species-habitat associations census <- fgeo.x::tree6_3species as_tibble( tt_test(census, habitats) )
#> Using `plotdim = c(320, 500)`. To change this value see `?tt_test()`.
#> Using `gridsize = 20`. To change this value see `?tt_test()`.
#> # A tibble: 12 x 8 #> habitat sp N.Hab Gr.Hab Ls.Hab Eq.Hab Rep.Agg.Neut Obs.Quantile #> * <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 1 CASARB 29 1242 356 2 0 0.776 #> 2 2 CASARB 20 390 1206 4 0 0.244 #> 3 3 CASARB 12 778 817 5 0 0.486 #> 4 4 CASARB 5 932 658 10 0 0.582 #> 5 1 PREMON 91 1093 504 3 0 0.683 #> 6 2 PREMON 89 1254 344 2 0 0.784 #> 7 3 PREMON 40 305 1292 3 0 0.191 #> 8 4 PREMON 14 270 1322 8 0 0.169 #> 9 1 SLOBER 18 273 1324 3 0 0.171 #> 10 2 SLOBER 24 810 788 2 0 0.506 #> 11 3 SLOBER 17 1155 440 5 0 0.722 #> 12 4 SLOBER 7 1292 303 5 0 0.808