Skip to contents

For a grouping of sites, such as the tilings returned by ps_tile_groups() or a vector of fixed regions, computes the average number of occupied sites in each site's group (across columns, for a matrix of groupings). This is the size of the pool each site is randomized within when the grouping is passed to ps_rand(site_groups = ...). Sites that are often in very small groups are rarely changed by fixed-margin randomizations; a site alone in its group is never changed.

Usage

ps_group_sizes(ps, groups, spatial = TRUE)

Arguments

ps

A phylospatial object.

groups

A grouping of sites in any form accepted by the site_groups argument of ps_rand().

spatial

Logical: return a spatial object (TRUE, the default) or a vector?

Value

A SpatRaster or sf object with a group_size variable, or a numeric vector with a value for every site (NA for unoccupied sites).

Examples

# \donttest{
if (requireNamespace("nullcat", quietly = TRUE)) {
  ps <- moss()
  tiles <- ps_tile_groups(ps, spacing = 200e3, n = 100)
  terra::plot(ps_group_sizes(ps, tiles))
}

# }