extract_layman {nichetools} | R Documentation |
extract Layman metrics
Description
Extract Bayesian estimates for the following six layman metrics,
\delta^{13}
C range, \delta^{15}
N range, total area (TA),
distance to centroid (CD), distance to the nearest neighbour (NND), and
the standard deviation of the distance to the nearest neighbour (SDNND)
from data objects created by
SIBER. To learn
more about the following metrics please review
Layman et al. (2008).
Usage
extract_layman(
data,
type = NULL,
community_df = NULL,
data_format = NULL,
isotope_x = NULL,
isotope_y = NULL,
element_x = NULL,
element_y = NULL
)
Arguments
data |
a |
type |
a |
community_df |
a two column data frame. One of the columns has to be named
|
data_format |
a |
isotope_x |
a |
isotope_y |
a |
element_x |
a |
element_y |
a |
Value
A tibble
containing four rows when data_format
is set to its
default which is long
. These four rows are the following, community
,
the_name_of_the_communities
, metric
and post_est
.
See Also
SIBER::bayesianLayman()
and SIBER::createSiberObject()
Examples
library(SIBER)
# ---- bring in SIBER demo data ----
# uncomenet to use
# str(demo.siber.data)
# ---- create community names data frame ----
# uncomment to use
# str(demo.siber.data.2)
demo.siber.data.2$community_names <- as.factor(demo.siber.data.2$community)
demo.siber.data.2$community <- as.numeric(demo.siber.data.2$community_names) |>
as.character()
c_names <- demo.siber.data.2 |>
dplyr::distinct(community, community_names)
# ---- create the siber object ----
siber.example <- createSiberObject(demo.siber.data)
# ---- view Bayesian estimates of mu and sigma produced by SIBER ---
# uncomment to use
# str(post_sam_siber)
# ---- extract posterior estimates of mu -----
mu_post <- extractPosteriorMeans(siber.example, post_sam_siber)
# ---- Bayesian estimates of layman metrics using SIBER ----
layman_b <- bayesianLayman(mu.post = mu_post)
# ---- use nichetools to extract Bayesian estimates of Layman metrics ----
layman_be <- extract_layman(layman_b, community_df = c_names)
layman_be