Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sPlot3_build
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sPlot
sPlot3_build
Commits
4ad5e6b4
Commit
4ad5e6b4
authored
6 years ago
by
Francesco Sabatini
Browse files
Options
Downloads
Patches
Plain Diff
Created script 02 for compiling dataset to solve all issues discovered in 00 and 01
parent
b291f906
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/02_Compile_dataset.Rmd
+61
-0
61 additions, 0 deletions
code/02_Compile_dataset.Rmd
with
61 additions
and
0 deletions
code/02_Compile_dataset.Rmd
0 → 100644
+
61
−
0
View file @
4ad5e6b4
---
title: "02_sPlot_compile.Rmd"
author: "Francesco Maria Sabatini"
date: "7/8/2019"
output: html_document
---
```{r setup, include=FALSE}
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)
2) Import field 'Herbs identified' into header (SH)
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
```{r}
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
```{r}
DT0 <- DT0 %>%
mutate(`Cover %` = replace(`Cover %`,
list= `Cover %` ==0 &
is.na(`Cover code`) &
Taxonomy=="USA_VegBank",
values= 0.1))
```
4) Formations - Assign zeros to columns (Forest, Grassland, Shrubland, Wetland, Sparse), when at least one 1 is present (FMS)
```{r}
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)
```
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment