There are `r sum(is.na(elevation.out$Elevation_median))` plots without elevation info, corresponding to `r round(sum(is.na(elevation.out$Elevation_median))/nrow(header)*100,1)`% of total.
There are `r sum(elevation.out$Elevation_median < -1, na.rm=T)` plots with elevation below sea level.
\newline
...
...
@@ -641,7 +645,8 @@ Join elevation data (only median)
Fix some errors. There are some plots where only p\\a information is available (`Cover code=="x"`), but have all zeros in the field `Cover %`. Consider this as presence\\absence and transform `Cover %` to 1.
Fix some errors. There are some plots where all species have zeros in the field `Cover %`. Some of them are marked as p\\a (`Cover code=="x"`), but other not. Consider all this plots as presence\\absence and transform `Cover %` to 1.
!! There are some other plots having layers with all zeros. This should be double-checked, but are not being transformed here !!
Consider all plot-layer combinations where `Cover code=="x"`, and all the entries of the field `Cover % == 1` as presence\\absence data, and transform `Ab_scale` to "pa". This is done to avoid confusion with plots where `Cover code=="x"` but "x" has to be intended as a class in the cover scale used. For p\\a plots, replace the field `Cover %` with NA, and assign the value 1 to the field `x_`.
There are `r nrow(try.species)` individual observations from `r nrow(try.species %>% distinct(Species))` distinct (unresolved) species in `r nrow(try.species %>% distinct(Genus))` distinct (unresolved) genera.
@@ -532,7 +498,7 @@ We used different sources of information:
4) Cross-match with species assigned to tree layer in DT table.
\newline\newline
Step 1: Derive growth form trait information to DT table. Growth form information derives from TRY
**Step 1**: Attach growth form trait information to DT table. Growth form information derives from TRY
```{r}
DT.gf <- DT2 %>%
filter(taxon_group=="Vascular plant") %>%
...
...
@@ -550,7 +516,7 @@ DT.gf <- DT2 %>%
sum(is.na(DT.gf$GrowthForm))
```
Step 2: Select most common species without growth-trait information to export and check manually
**Step 2**: Select most common species without growth-trait information to export and check manually
```{r}
top.gf.nas <- DT.gf %>%
filter(is.na(GrowthForm)) %>%
...
...
@@ -558,7 +524,7 @@ top.gf.nas <- DT.gf %>%
summarize(n=n()) %>%
arrange(desc(n))
```
```{r, eval=F}
```{r, eval=F, message=F}
write_csv(top.gf.nas %>%
filter(n>1000),
path="../_derived/Species_missingGF.csv")
...
...
@@ -566,6 +532,7 @@ write_csv(top.gf.nas %>%
The first `r nrow(top.gf.nas)` species account for `r round(sum(top.gf.nas %>% filter(n>1000) %>% pull(n))/sum(top.gf.nas$n)*100,2)`% of the missing records. Assign growth forms manually, reimport and coalesce into `DT.gf`
```{r}
# Import manually classified species - this info is also reported in Appendix 1
After manual completion, the number of records without growth form information decresead to `r sum(is.na(DT.gf$GrowthForm))`.
\newline\newline
Step 3: Import additional data on growth-form from TRY (Accessed 10 March 2020).
**Step 3**: Import additional data on growth-form from TRY (Accessed 10 March 2020).
All public data on growth form downloaded. First take care of unmatched quotation marks in the txt file. Do this from command line.
```{bash, eval=F}
# escape all unmatched quotation marks. Run in Linux terminal
...
...
@@ -586,7 +553,7 @@ All public data on growth form downloaded. First take care of unmatched quotatio
#sed "s/'/\\'/g" 8854.txt > 8854_test.csv
```
Information on growth form is not organized and has a myriad of levels. Extract and simplify to the set of few types used so far. In case a species is attributed to multiple growth forms use a majority vote.
#Some species have multiple attributions - use a majority vote. NA if ties
get.mode <- function(x){
if(length(unique(x))==1){
return(as.character(unique(x)))} else{
tmp <- sort(table(x), decreasing=T)
if(tmp[1]!=tmp[2]){return(names(tmp)[1])} else {
#return(paste0(names(tmp)[1:2], collapse="/"))}
return("Unknown")}
}
}
...
...
@@ -640,7 +608,7 @@ DT.gf <- DT.gf %>%
dplyr::select(-GrowthForm_simplified)
```
Step 4: Cross-match. Assign all species occurring in at least one relevé in the tree layer as tree. Conservatively, do this only when the record is at species level (exclude records at genus\\family level)
**Step 4**: Cross-match. Assign all species occurring in at least one relevé in the tree layer as tree. Conservatively, do this only when the record is at species level (exclude records at genus\\family level)
```{r}
other.trees <- DT.gf %>%
filter(Layer==1 & is.na(GrowthForm)) %>%
...
...
@@ -672,6 +640,9 @@ Define a species as `is.not.tree.or.shrub.and.small` when it has a height <10, a
Combine classifications from the three criteria. Use majority vote to assign plots. In case of ties, a progressively lower priority is given from criterium 1 to criterim 4.
Combine classifications from the three criteria. Use majority vote to assign plots. In case of ties, a progressively lower priority is given from criterium 1 to criterium 4.
Through the process described above, we managed to classify `r plot.vegtype %>% filter(is.forest==T | is.non.forest==T) %>% nrow()`, of which `r plot.vegtype %>% filter(is.forest==T) %>% nrow()` is forest and `r plot.vegtype %>% filter(is.non.forest==T) %>% nrow()` is non-forest.