View source: R/reconstruct_env_qual.R
reconstruct_env_qual | R Documentation |
Uses fossil community trait summaries to reconstruct the most likely environmental category by projecting them onto a qualitative ecometric space built from modern data. Optionally, it assigns each fossil point to the nearest modern sampling point.
reconstruct_env_qual(
fossildata,
model_out,
match_nearest = TRUE,
fossil_lon = NULL,
fossil_lat = NULL,
modern_id = NULL,
modern_lon = NULL,
modern_lat = NULL,
crs_proj = 4326
)
fossildata |
A data frame containing fossil trait summaries per fossil site.
Must include columns corresponding to the same two summary metrics used for modern communities,
using the column names specified by |
model_out |
Output list from |
match_nearest |
Logical; if TRUE, matches each fossil to the nearest modern point (default = TRUE). |
fossil_lon |
Name of the longitude column in |
fossil_lat |
Name of the latitude column in |
modern_id |
Name of the unique ID column in modern points (optional for metadata merging). |
modern_lon |
Name of the longitude column in modern points. Required if |
modern_lat |
Name of the latitude column in modern points. Required if |
crs_proj |
Coordinate reference system for sf operations (default = EPSG:4326). |
A data frame (fossildata
) updated with:
Assigned bin number for the first trait axis (based on first summary metric of trait distribution of fossil communities).
Assigned bin number for the second trait axis (based on second summary metric of trait distribution of fossil communities).
Predicted environmental category based on trait bin.
Probability of each environmental category for the assigned bin.
(Optional) ID of the nearest modern sampling point (if match_nearest = TRUE
).
Additional columns from the matched modern site if match_nearest = TRUE
.
# Load internal data
data("geoPoints", package = "commecometrics")
data("traits", package = "commecometrics")
data("spRanges", package = "commecometrics")
data("fossils", package = "commecometrics")
# Step 1: Summarize trait values at sampling points
traitsByPoint <- summarize_traits_by_point(
points_df = geoPoints,
trait_df = traits,
species_polygons = spRanges,
trait_column = "RBL",
species_name_col = "sci_name",
continent = FALSE,
parallel = FALSE
)
# Step 2: Run a qualitative ecometric model (e.g., land cover class)
ecoModelQual <- ecometric_model_qual(
points_df = traitsByPoint$points,
category_col = "vegetation",
min_species = 3
)
# Step 3: Reconstruct qualitative environments for fossil data
reconQual <- reconstruct_env_qual(
fossildata = fossils,
model_out = ecoModelQual,
match_nearest = TRUE,
fossil_lon = "Long",
fossil_lat = "Lat",
modern_id = "ID",
modern_lon = "Longitude",
modern_lat = "Latitude"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.