-
Notifications
You must be signed in to change notification settings - Fork 0
/
READ.FRENCH.NFI.Rmd
80 lines (56 loc) · 2.73 KB
/
READ.FRENCH.NFI.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
% Formatting of the French NFI data
% Georges Kunstler
```{r options-chunk}
opts_chunk$set(dev= c('pdf','svg'), fig.width= 10, fig.height = 5)
output.dir <- 'output'
dir.create(output.dir)
source(file.path("R", "READ_FRENCH_NFI.R"))
```
# Description of the data
The data were downloaded from the French [NFI website](http://inventaire-forestier.ign.fr/spip/spip.php?rubrique153). You need to provides basic information (name, email and purpose of the use of the data) to download the data on the website.
For each year of inventory there is 8 data files. The file need to be merged over all years. There is however some discrepancy in the variables and coding that need to be deal with. This code provides the merging for the **Tree** data, the **Plot** data, the **Ecological** data, the **Dead tree** data.
The data need to be in a folder *data* with a subfolder for each year (2008, 2006, ... 2013).
# READ, MERGE AND CLEAN ALL TREE DATA NEW METHODS
Read the data for each year, homogenize and save.
```{r Read tree data, message=FALSE}
data.tree <- read_tree()
save(data.tree,file=file.path(output.dir, "data.tree.Rdata"))
```
# READ, MERGE AND CLEAN ALL SPECIES COVER DATA NEW METHODS
Read the data for each year, homogenize and save.
```{r Read tree data, message=FALSE}
data.couv <- read_couv()
save(data.couv,file=file.path(output.dir, "data.couv.Rdata"))
```
# READ, MERGE AND CLEAN ALL DEAD TREE DATA NEW METHODS
Read the dead tree data for each year, homogenize and save.
```{r Read dead tree data, message=FALSE}
data.tree.dead <- read_dead_tree()
save(data.tree.dead,file=file.path(output.dir,"data.tree.dead.Rdata"))
```
# MERGE DEAD AND ALIVE TREE
```{r merge dead and alive tree files, message=FALSE}
tree.dead.alive <- merge_dead_alive(data.tree, data.tree.dead)
save(tree.dead.alive,file=file.path(output.dir, 'tree.dead.alive.Rdata'))
```
# READ, MERGE AND CLEAN ALL PLOT DATA NEW METHODS
Read the plot data for each year, replace with NA variable missing in 2008 and merge plot data.
```{r Read plot data, message=FALSE}
data.plot <- read_plot()
save(data.plot,file=file.path(output.dir, "data.plot.Rdata"))
```
## set coordinates and projection and map plots
```{r plot x y, message=FALSE, fig.cap="Plot distribution in France"}
map_plot(data.plot)
```
# READ ECOLOGICAL DATA (SOIL AND ABIOTIC VARIABLES)
Read the ecological data for each year and remove new variables from 2013
```{r Read ecological data, message=FALSE}
data.ecol <- read_ecological_data()
save(data.ecol, file=file.path(output.dir, "data.ecol.Rdata"))
```
# READ CSV TABLE WITH LATIN NAME and CODE FOR NFI DATA
```{r Read species name, message=FALSE}
species.tab <- read.csv("data/species.csv",sep="\t")
species.tab2 <- species.tab[!is.na(species.tab$Latin_name),]
```