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

v1.2, refined selection plots in header

parent a27a6adb
No related branches found
No related tags found
No related merge requests found
...@@ -16,9 +16,10 @@ always_allow_html: yes ...@@ -16,9 +16,10 @@ always_allow_html: yes
**Timestamp:** `r date()` **Timestamp:** `r date()`
**Drafted:** Francesco Maria Sabatini **Drafted:** Francesco Maria Sabatini
**Version:** 1.1 **Version:** 1.2
*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.
<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 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
...@@ -180,7 +181,7 @@ DT.xylem %>% ...@@ -180,7 +181,7 @@ DT.xylem %>%
# 3 Calculate CWMs and trait coverage # 3 Calculate CWMs and trait coverage
Calculate CWM and trait coverage for each trait and each plot. Select plots having more than 80% coverage for at least one trait. Calculate CWM and trait coverage for each trait and each plot. ~~Select plots having more than 80% coverage for at least one trait.~~
```{r, cache=T, cache.lazy=F} ```{r, cache=T, cache.lazy=F}
# Merge species data table with traits # Merge species data table with traits
CWM.xylem0 <- DT.xylem %>% CWM.xylem0 <- DT.xylem %>%
...@@ -264,34 +265,43 @@ knitr::kable(CWM.xylem[1:20,], caption="Example of CWM data file") %>% ...@@ -264,34 +265,43 @@ knitr::kable(CWM.xylem[1:20,], caption="Example of CWM data file") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"), full_width = F, position = "center") kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"), full_width = F, position = "center")
``` ```
```{r} ```{r fig.width=8, fig.height=5, dpi=150, fig.align="center", fig.cap="Density of plots with CWM info, for increasing trait coverage."}
CWM.xylem08 <- CWM.xylem %>% ggtc <- ggplot(data=CWM.xylem) +
filter(trait.coverage>=0.8) geom_density(aes(trait.coverage, col=trait)) +
xlab("Trait coverage (abundance)") +
theme_bw()
ggnsp <- ggplot(data=CWM.xylem) +
geom_density(aes(trait.coverage.nspecies, col=trait)) +
xlab("Trait coverage (Presence absence)") +
theme_bw()
cowplot::plot_grid(ggtc, ggnsp, nrow=1)
``` ```
```{r, echo=F} ```{r, echo=F, eval=F}
knitr::kable(CWM.xylem08 %>% #knitr::kable(CWM.xylem08 %>%
group_by(trait) %>% # group_by(trait) %>%
summarize("num.plots"=n(), .groups="drop"), caption="Number of plots with >=.8 coverage per trait") %>% # summarize("num.plots"=n(), .groups="drop"), caption="Number of plots with >=.8 coverage per trait") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"), full_width = F, position = "center") # kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"), full_width = F, position = "center")
``` ```
```{r} ```{r}
#Create list of plots having at least one trait with >=.8 coverage and extract header data #Create list of plots for which CWM data is available
plot.sel2 <- CWM.xylem %>%
distinct(PlotObservationID) %>%
pull(PlotObservationID)
#plot80perc <- (CWM.xylem %>% header.xylem <- header.xylem %>%
# dplyr::select(PlotObservationID) %>% filter(PlotObservationID %in% plot.sel2)
# distinct())$PlotObservationID
#DT.xylem08 <- DT.xylem %>%
# filter(PlotObservationID %in% header.xylem$PlotID)
#CWM.xylem <- CWM.xylem %>%
# filter(PlotObservationID %in% header.xylem$PlotID)
``` ```
Completeness of header data
Evaluate completeness of header data
```{r, echo=F} ```{r, echo=F}
knitr::kable(data.frame(Completeness_perc=colSums(!is.na(header.xylem))/ knitr::kable(data.frame(Completeness_perc=colSums(!is.na(header.xylem))/
nrow(header.xylem)*100)[-c(1,2),,drop=F], nrow(header.xylem)*100)[-c(1,2),,drop=F],
...@@ -333,7 +343,7 @@ The data derive from `r nrow(data.origin)` datasets. ...@@ -333,7 +343,7 @@ The data derive from `r nrow(data.origin)` datasets.
```{r} ```{r}
soilclim.xylem <- soilclim %>% soilclim.xylem <- soilclim %>%
filter(PlotObservationID %in% plot.sel) %>% filter(PlotObservationID %in% plot.sel2) %>%
dplyr::rename(Elevation=Elevation_median) %>% dplyr::rename(Elevation=Elevation_median) %>%
dplyr::select(-Elevation_q2.5, -Elevation_q97.5, -Elevation_DEM.res) dplyr::select(-Elevation_q2.5, -Elevation_q97.5, -Elevation_DEM.res)
``` ```
......
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