assignNetworkMembership: Assign network membership to adaptive cluster sample units.

View source: R/assignNetworkMembership.R

assignNetworkMembershipR Documentation

Assign network membership to adaptive cluster sample units.

Description

This function assigns network membership to units in an adaptive cluster sample; if units are neighbors, they are assigned the same network ID.

Usage

assignNetworkMembership(popdata, plot.size = 1)

Arguments

popdata

A data frame providing information about the population to be sampled. Required columns include geographic coordinate columns x and y, as well as a column containing the variable of interest, whose name is provided to the function via the yvar argument.

plot.size

The length and width of plots, in coordinate units. Defaults to 1.

Value

Returns the popdata data.frame with a new column for Network ID as well as a column for m, the number of units in each network.

References

\insertRef

saubyadaptiveACSampling

Examples

data(Thompson1990Fig1Pop)

# plot species abundance
library(magrittr)
library(ggplot2)
library(dplyr)
dat <- Thompson1990Fig1Pop %>% 
	filter(y_value > 0)
ggplot(dat, aes(x,y, size=y_value)) + geom_point()

# assign network membership of units containing the species of interest
P_networks <- assignNetworkMembership(Thompson1990Fig1Pop %>%
	 filter(y_value > 0))

# plot networks
ggplot(
	data=P_networks, 
	aes(x,y, size=y_value, shape=factor(NetworkID))
) + geom_point()
# coordinates should be given as x and y

ksauby/ACS documentation built on Aug. 18, 2022, 3:33 a.m.