Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
02_Compile_dataset.Rmd 2.33 KiB
title: "02_sPlot_compile.Rmd"
author: "Francesco Maria Sabatini"
date: "7/8/2019"
output: html_document
knitr::opts_chunk$set(echo = TRUE)

Previously known problems still to be fixed:

  1. Import field 'Plants Recorded' into header (SH) - create dictionary of possible factors (FMS).Values not available for EVA's datasets. Ask Milan if we can simply assume 'All vascular plants'
  2. Import field 'Herbs identified' into header (SH) - Values not available for EVA's datasets. According to SH, we can simply assume Y.
  3. Database with empty 'Cover code' value in DT - British_columbia_meadows and USA_VegBank (FMS)
  4. Formations - Assign zeros to columns (Forest, Grassland, Shrubland, Wetland, Sparse), when at least one 1
  5. Link to EUNIS cross-link table, and assign Faber-Langedon Formation (FMS)
  6. Assign plot elevation using external sources (FMS)
  7. Add GIVD codes

Arbitrarily set location uncertainty to -100, for missing values

Additional data from external sources

  1. SoilGrids
  2. Chelsa

!!! ADD ALSO A NOTE TO THE _x field to mention this is pa data !!! 3) Fix problem for British_Columbia_meadows, by arbitrarily assigning a 0.1% cover to all lichens/mosses

DT0 <- DT0 %>%
  mutate(`Cover %` = replace(`Cover %`,
                             list=   `Cover %` ==0  & 
                                      is.na(`Cover code`) & 
                                      Taxonomy=="British_Columbia_meadows" & 
                                      Layer=="9",
                             values= 0.1))

Fix problems for USA_VegBank, by arbitrarily assigning a 0.1% cover to all species without cover value

DT0 <- DT0 %>%
  mutate(`Cover %` = replace(`Cover %`,
                             list=   `Cover %` ==0  & 
                                      is.na(`Cover code`) & 
                                      Taxonomy=="USA_VegBank",
                             values= 0.1))
  1. Formations - Assign zeros to columns (Forest, Grassland, Shrubland, Wetland, Sparse), when at least one 1 is present (FMS)
header <- header %>%
  mutate(any1=rowSums(select(., Forest:Shrubland), na.rm=T)) %>%
  mutate_at(.vars = vars(Forest:Shrubland), 
            .funs = ~ifelse(any1>0, ifelse(!is.na(.), ., 0), 0)) %>%
  select(Forest:Shrubland, any1) %>% 
  filter(any1>0)