-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path4_statistical_prep.R
24 lines (21 loc) · 1.16 KB
/
4_statistical_prep.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
source("0_functions_plot.R")
##dataset preperation
res.data <- read.csv("03_processed_data_complete_final.csv",check.names=FALSE)
res.data <- filter(res.data,
Study_midyear>=1987,
Meas_method %in% c('IRGA','Gas Chromatography')
&Ecosystem_type != 'Agriculture'
& Outlier == 0)
dv = c('Rs_annual')
idv = c('Study_midyear','Latitude','Biome',
'MAT','MAP', 'delta.Mean.Temp.','MAP','delta.Mean.Precip.', 'SOC_stock',
'Meas_method','Ecosystem_type','Partition_method','Stage','Elevation')
work.data = na.omit(res.data[,c(idv,dv)])
work.data <- droplevels(work.data)
work.data$Year = as.character(lapply(work.data$Study_midyear,labelYear1)) %>% as.factor()
work.data$Year2 = as.character(lapply(work.data$Study_midyear,labelYear2)) %>% as.factor()
boreal = filter(work.data, Biome == "boreal"|Biome == "Arctic")
Temperate = filter(work.data, Biome == "Temperate"|Biome == "Mediterranean" )
Tropical = filter(work.data, Biome == "Tropical" | Biome == "Subtropical")
Bef2008 = filter(work.data, Year2 == "1960-2008" )
Post2008 = filter(work.data, Year2 == "2008-2016" )