Skip to content
Snippets Groups Projects
Commit 4a62680c authored by Francesco Sabatini's avatar Francesco Sabatini
Browse files

Improved species matching, corr prop. sp. with traits

parent c092b99b
No related branches found
No related tags found
No related merge requests found
......@@ -16,9 +16,10 @@ always_allow_html: yes
**Timestamp:** `r date()`
**Drafted:** Francesco Maria Sabatini
**Version:** 1.2
**Version:** 1.3
*Changes to version 1.2* - Corrected final selection of plots in header. Only plots with CWM info are retained, but no minimum trait coverage threshold is used.
*Changes to version 1.3* - Resolved species list from xylem_data using TNRS to improve matching. Account for unresolved species when calculating the proportion of species with traits used for calculating CWMs. Relative covers are not normalized to 100% by plot x layer.
<br>
This report documents the data extraction for **sPlot project proposal #31** - *The adaptive value of xylem physiology within and across global ecoregions* as requested by Daniel Laughlin and Jesse Robert Fleri
......@@ -59,6 +60,52 @@ Import data on xylem traits, provided by Jesse Robert Fleri on October 26th, 202
load("xylem_data.RData")
```
Create list of species to submit to [TNRS](https://tnrs.biendata.org/) for taxonomic standardization
```{r}
xylem_data %>%
dplyr::select(Species) %>%
mutate(Species=factor(Species)) %>%
write_delim(file="Species_list.txt", delim="\t")
```
Reimport resolved species names
```{r}
xylem_resolved <- read_csv("tnrs_result.csv")
```
```{r, echo=F}
knitr::kable(xylem_resolved,
caption="Resolved names from TNRS") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"),
full_width = F, position = "center")%>%
scroll_box(width = "1000px", height = "600px")
```
Associate resolved names to xylem data names to improve matching with sPlot's DT2
```{r, warning=F, message=F}
xylem_data <- xylem_data %>%
left_join(xylem_resolved %>%
dplyr::select(Name_submitted, Accepted_species, Taxonomic_status) %>%
mutate_all(~as.character(.)),
by=c("Species"="Name_submitted")) %>%
mutate(Coalesced_Species=coalesce(Accepted_species, Species)) %>%
ungroup()
```
There are `r xylem_data %>% filter(Species != Coalesced_Species) %>% nrow()` which changed names after taxonomic resolution.
<br>
Attach synonyms to the bottom of xylem data to maximize matching with sPlot. After standardization, some species have multiple entries for traits. Calculate species level means
```{r, warning=F, message=F}
xylem_data <- xylem_data %>%
dplyr::select(Coalesced_Species, Group, P50, Ks) %>%
rename(Species=Coalesced_Species) %>%
bind_rows(xylem_data %>%
filter(Species != Coalesced_Species) %>%
dplyr::select(Species:Ks)) %>%
distinct(Species, .keep_all=T) %>%
group_by(Species) %>%
summarize_at(.vars=vars(P50, Ks),
.funs=list(~mean(., na.rm=T))) %>%
ungroup()
```
# 1 Extract plots from sPlot based on species with xylem traits
Extract all plots containing at least one species in the xylem list.
```{r, message=F, results=F, warning=F}
......@@ -150,15 +197,16 @@ combine.cover <- function(x){
}
DT.xylem <- DT.xylem %>%
dplyr::select(PlotObservationID, Species,Layer, Relative_cover) %>%
# normalize relative cover to 1 for each plot x layer combination
left_join({.} %>%
group_by(PlotObservationID, Layer) %>%
summarize(Tot.Cover=sum(Relative_cover), .groups="drop"),
by=c("PlotObservationID", "Layer")) %>%
mutate(Relative_cover=Relative_cover/Tot.Cover) %>%
group_by(PlotObservationID, Species) %>%
# merge layers together
dplyr::select(PlotObservationID, Species, Species_original, Layer, Relative_cover) %>%
# # normalize relative cover to 1 for each plot x layer combination
# # Commented in version 1.3
# left_join({.} %>%
# group_by(PlotObservationID, Layer) %>%
# summarize(Tot.Cover=sum(Relative_cover), .groups="drop"),
# by=c("PlotObservationID", "Layer")) %>%
# mutate(Relative_cover=Relative_cover/Tot.Cover) %>%
group_by(PlotObservationID, Species, Species_original) %>%
# # merge layers together
summarize(Relative_cover=combine.cover(Relative_cover), .groups="drop") %>%
ungroup() %>%
# normalize relative cover to 1 after merging layers together
......@@ -186,7 +234,7 @@ Calculate CWM and trait coverage for each trait and each plot. ~~Select plots ha
# Merge species data table with traits
CWM.xylem0 <- DT.xylem %>%
as_tibble() %>%
dplyr::select(PlotObservationID, Species, Relative_cover) %>%
dplyr::select(PlotObservationID, Species, Species_original, Relative_cover) %>%
left_join(xylem_data %>%
dplyr::select(Species, P50, Ks),
by="Species")
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment