-
Notifications
You must be signed in to change notification settings - Fork 0
/
SAE_Phil_Change.R
571 lines (498 loc) · 41.3 KB
/
SAE_Phil_Change.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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
#Unbiased Area Estimation of Philippines Forest Change
#Written by Karis Tenneson and Crystal Wespestad (SIG) Feb, 2022
#####################################################################
library(survey)
library(tidyverse)
library(knitr)
library(rmarkdown)
library(tidyr)
library(networkD3)
library(tidyverse)
library(dplyr)
setwd("C:\\Users\\cryst\\OneDrive\\Documents\\Philippines\\PhilippinesQAQCanalysis")
# CEO data (Original with CEO duplicate bug)
#file replace with one with duplicates removed
dataCEO <- read.csv('C:\\Users\\cryst\\OneDrive\\Documents\\Philippines\\PhilippinesQAQCanalysis\\data\\ceo-Philippines_Change_madeJan18_SingleInterpretation_Final_V2-sample-data-2022-03-02_no duplicates.csv')
#find the erroneously duplicated plots, which should not be duplicates. Asked which should be kept.
dataCEO$ï..plotid[duplicated(dataCEO$ï..plotid)] #found 274 282 288 288 330 393 868
sort(dataCEO$lon[duplicated(dataCEO$lon)])
duplicated(dataCEO[c("lon","lat")])
dataCEO$lon[duplicated(dataCEO$lat)]
dim(dataCEO)
table(dataCEO$Land.cover.in.2000.)
table(dataCEO$Type.of.forest.)
table(dataCEO$Type.of.non.forest.land.cover.)
#upload the additional CEO points (150)
#double interpretations with duplicates removed
dataCEO_TOADD <- read.csv("C:\\Users\\cryst\\OneDrive\\Documents\\Philippines\\PhilippinesQAQCanalysis\\data\\ceo-Philippines_Change_madeJan18_QAQC-sample-data-2022-01-28.csv")
#############Used this to find erroneous duplicates
dataCEO_TOADD$ï..plotid[duplicated(dataCEO_TOADD$ï..plotid)]
dim(dataCEO_TOADD)
colnames(dataCEO)==colnames(dataCEO_TOADD)
#make column names agree
dataCEO_TOADD$Is.this.a.mixed.land.cover.pixel. <- "Not Measured"
colnames(dataCEO)[colnames(dataCEO) == "ï..plotid"] <- "plotid"
colnames(dataCEO)==colnames(dataCEO_TOADD)
#group interpreted CEO points
dataCEO_combo <- merge(dataCEO, dataCEO_TOADD, by.x =c('lon','lat'), by.y = c('lon','lat'), all.x=T)
dim(dataCEO_combo)
##dataCEO_combo<-rbind(dataCEO_TOADD, dataCEO) ##removed because lon/lat of TOADD are in dataCEO_combo
nrow(dataCEO_combo)
head(dataCEO_combo)
tail(dataCEO_combo)
###########RESOLVE THE DUPLICATES BETWEEN THE ADDED DATA AND SINGLE INTERPRETATIONS
###########THE QAQC POINTS WILL REPLACE THOSE DONE BY SINGLE INTERPRETERS
##########################################################
#An inelegant way to combine the QAQC data with the original
for(i in 1:nrow(dataCEO_combo)) {
dataCEO_combo$confidence<-ifelse(is.na(dataCEO_combo[,53]), dataCEO_combo[,14],
ifelse(!is.na(dataCEO_combo[,53]), dataCEO_combo[,53],'nope'))
}
for(i in 1:nrow(dataCEO_combo)) {
dataCEO_combo$CHANGESTRATA_check<-ifelse(is.na(dataCEO_combo[,34]), dataCEO_combo[,13],
ifelse(!is.na(dataCEO_combo[,34]), dataCEO_combo[,33],'nope'))
}
for(i in 1:nrow(dataCEO_combo)) {
dataCEO_combo$DISTURBANCE<-ifelse(is.na(dataCEO_combo[,34]), dataCEO_combo[,14],
ifelse(!is.na(dataCEO_combo[,34]), dataCEO_combo[,34],'nope'))
}
for(i in 1:nrow(dataCEO_combo)) {
dataCEO_combo$DISTTYPE<-ifelse(is.na(dataCEO_combo[,34]), dataCEO_combo[,15],
ifelse(!is.na(dataCEO_combo[,34]), dataCEO_combo[,35],'nope'))
}
for(i in 1:nrow(dataCEO_combo)) {
dataCEO_combo$DESCRIBE_DIST<-ifelse(is.na(dataCEO_combo[,34]), dataCEO_combo[,16],
ifelse(!is.na(dataCEO_combo[,34]), dataCEO_combo[,36],'nope'))
}
for(i in 1:nrow(dataCEO_combo)) {
dataCEO_combo$YEAR<-ifelse(is.na(dataCEO_combo[,34]), dataCEO_combo[,17],
ifelse(!is.na(dataCEO_combo[,34]), dataCEO_combo[,37],'nope'))
}
for(i in 1:nrow(dataCEO_combo)) {
dataCEO_combo$DEF_DRIVER<-ifelse(is.na(dataCEO_combo[,34]), dataCEO_combo[,18],
ifelse(!is.na(dataCEO_combo[,34]), dataCEO_combo[,38],'nope'))
}
for(i in 1:nrow(dataCEO_combo)) {
dataCEO_combo$DEG_DRIVER<-ifelse(is.na(dataCEO_combo[,34]), dataCEO_combo[,19],
ifelse(!is.na(dataCEO_combo[,34]), dataCEO_combo[,39],'nope'))
}
#Update the column names for original CEO data to shorten them
colnames(dataCEO_combo)
colnames(dataCEO_combo)[14]<-"confidence"
colnames(dataCEO_combo)[15]<-"confidence.reasoning"
colnames(dataCEO_combo)[16]<-"LC2000a"
colnames(dataCEO_combo)[17]<-"Forest.Type.2000"
colnames(dataCEO_combo)[18]<-"NonForest.Type.2000"
colnames(dataCEO_combo)[19]<-"Crop.Type.2000"
colnames(dataCEO_combo)[20]<-"LC2018end"
colnames(dataCEO_combo)[21]<-"forest.change.event"
colnames(dataCEO_combo)[23]<-"ChangeType.1"
colnames(dataCEO_combo)[24]<-"Degradation.Driver.1"
colnames(dataCEO_combo)[25]<-"Loss.Driver.1"
colnames(dataCEO_combo)[26]<-"second.forest.change.event"
colnames(dataCEO_combo)[28]<-"ChangeType.2"
colnames(dataCEO_combo)[29]<-"Degradation.Driver.2"
colnames(dataCEO_combo)[30]<-"Loss.Driver.2"
colnames(dataCEO_combo)[31]<-"third.forest.change.event"
colnames(dataCEO_combo)[33]<-"ChangeType.3"
colnames(dataCEO_combo)[34]<-"Degradation.Driver.3"
colnames(dataCEO_combo)[35]<-"Loss.Driver.3"
colnames(dataCEO_combo)[36]<-"morethan3.forest.changes"
colnames(dataCEO_combo)[37]<-"describe.extra.changes"
colnames(dataCEO_combo)[38]<-"Forest.Type.2018"
colnames(dataCEO_combo)[39]<-"NonForest.Type.2018"
colnames(dataCEO_combo)[40]<-"Crop.Type.2018"
colnames(dataCEO_combo)[41]<-"mixed.lc.pixel"
colnames(dataCEO_combo)
#output the cleaned CEO data
write.csv(dataCEO_combo, file = 'Results\\Philippines_CEO_FinalPoints_SAVE.csv', row.names = F)
##########Join points with map strata values##################
# #Map strata dictionary -- projects/sig-ee/Philippines/v2/strata/gapFillStrata-2-2-0
# 31: "deforested epoch 1",
# 32: "deforested epoch 2 & 3",
# 41: "reforested epoch 1",
# 42: "reforested epoch 2 & 3",
# 50: "stable forest",
# 60: "stable non forest",
# 70: "multiple events noise",
# 80: "multiple events ecologically possible",
## file created of extracted map strata from exported dataCEO_combo
data_mapstrata <- read.csv("C:\\Users\\cryst\\OneDrive\\Documents\\Philippines\\PhilippinesQAQCanalysis\\data\\PhilippinesPointsCombo_Strata.csv")
dim(data_mapstrata)
colnames(data_mapstrata)
#####Join fire results to original CSV points based on plotid
datamerged <- merge(dataCEO_combo, data_mapstrata[c('pl_change_strata','plotid')], by.x =c('plotid'), by.y = c('plotid'), all.x=T)
head(datamerged)
dim(datamerged)
#########################################################################################
####Found a couple illogical points which were removed, and the fixed file was reimported
#############Re-import created file after illogical points fixed by Trina and Liz
datamerged_FIXED <- read.csv("C:\\Users\\cryst\\OneDrive\\Documents\\Philippines\\PhilippinesQAQCanalysis\\data\\Philippines_compiled_checked_TrinaLiz.csv")
dim(datamerged_FIXED)
colnames(datamerged_FIXED)[1]<-"ChangeStrata_Map"
datamerged_FIXED <- datamerged_FIXED[-c(43:48)]
colnames(datamerged_FIXED)
#add a human readable column for change strata
colnames(datamerged)[42]<-"ChangeStrata_Map"
datamerged_FIXED$ReadableChangeStrata_Map_v1<-"fixMe"
datamerged_FIXED$ReadableChangeStrata_Map_v1[datamerged_FIXED$ChangeStrata_Map == 31]<-"deforested epoch 1"
datamerged_FIXED$ReadableChangeStrata_Map_v1[datamerged_FIXED$ChangeStrata_Map == 32]<-"deforested epoch 2 & 3"
datamerged_FIXED$ReadableChangeStrata_Map_v1[datamerged_FIXED$ChangeStrata_Map == 41]<-"reforested epoch 1"
datamerged_FIXED$ReadableChangeStrata_Map_v1[datamerged_FIXED$ChangeStrata_Map == 42]<-"reforested epoch 2 & 3"
datamerged_FIXED$ReadableChangeStrata_Map_v1[datamerged_FIXED$ChangeStrata_Map == 50]<-"stable forest"
datamerged_FIXED$ReadableChangeStrata_Map_v1[datamerged_FIXED$ChangeStrata_Map == 60]<-"stable non forest"
datamerged_FIXED$ReadableChangeStrata_Map_v1[datamerged_FIXED$ChangeStrata_Map == 70]<-"multiple events noise"
datamerged_FIXED$ReadableChangeStrata_Map_v1[datamerged_FIXED$ChangeStrata_Map == 80]<-"multiple events ecologically possible"
unique(datamerged_FIXED$ReadableChangeStrata_Map_v1)
colnames(datamerged_FIXED)
##### Epoch 1 = 2000-2005
##### Epoch 2 = 2006-2012
##### Epoch 3 = 2013-2018
########Simplified Map data
datamerged_FIXED$ReadableChangeStrata_Map_v2<-"fixMe"
datamerged_FIXED$ReadableChangeStrata_Map_v2[datamerged_FIXED$ChangeStrata_Map == 31]<-"Deforestation"
datamerged_FIXED$ReadableChangeStrata_Map_v2[datamerged_FIXED$ChangeStrata_Map == 32]<-"Deforestation"
datamerged_FIXED$ReadableChangeStrata_Map_v2[datamerged_FIXED$ChangeStrata_Map == 41]<-"Reforestation"
datamerged_FIXED$ReadableChangeStrata_Map_v2[datamerged_FIXED$ChangeStrata_Map == 42]<-"Reforestation"
datamerged_FIXED$ReadableChangeStrata_Map_v2[datamerged_FIXED$ChangeStrata_Map == 50]<-"stable forest"
datamerged_FIXED$ReadableChangeStrata_Map_v2[datamerged_FIXED$ChangeStrata_Map == 60]<-"stable non forest"
datamerged_FIXED$ReadableChangeStrata_Map_v2[datamerged_FIXED$ChangeStrata_Map == 70]<-"multiple events noise"
datamerged_FIXED$ReadableChangeStrata_Map_v2[datamerged_FIXED$ChangeStrata_Map == 80]<-"multiple events ecologically possible"
unique(datamerged_FIXED$ReadableChangeStrata_Map_v2)
colnames(datamerged_FIXED)
########Simplified Map data
datamerged_FIXED$ReadableChangeStrata_Map_v3<-"fixMe"
datamerged_FIXED$ReadableChangeStrata_Map_v3[datamerged_FIXED$ChangeStrata_Map == 31]<-"Deforestation"
datamerged_FIXED$ReadableChangeStrata_Map_v3[datamerged_FIXED$ChangeStrata_Map == 32]<-"Deforestation"
datamerged_FIXED$ReadableChangeStrata_Map_v3[datamerged_FIXED$ChangeStrata_Map == 41]<-"Reforestation"
datamerged_FIXED$ReadableChangeStrata_Map_v3[datamerged_FIXED$ChangeStrata_Map == 42]<-"Reforestation"
datamerged_FIXED$ReadableChangeStrata_Map_v3[datamerged_FIXED$ChangeStrata_Map == 50]<-"stable forest"
datamerged_FIXED$ReadableChangeStrata_Map_v3[datamerged_FIXED$ChangeStrata_Map == 60]<-"stable non forest"
datamerged_FIXED$ReadableChangeStrata_Map_v3[datamerged_FIXED$ChangeStrata_Map == 70]<-"multiple events"
datamerged_FIXED$ReadableChangeStrata_Map_v3[datamerged_FIXED$ChangeStrata_Map == 80]<-"multiple events"
unique(datamerged_FIXED$ReadableChangeStrata_Map_v3)
colnames(datamerged_FIXED)
############## Strata pixel counts #############
strataAreas <- read.csv("C:\\Users\\cryst\\OneDrive\\Documents\\Philippines\\PhilippinesQAQCanalysis\\data\\philippines_pixelcounts.csv")
head(strataAreas)
datamerged_FIXED <- merge(datamerged_FIXED, strataAreas, by.x = 'ChangeStrata_Map', by.y = 'Map.value', all.x = F)
dim(datamerged_FIXED)
############Set up clean CEO labels - Version 1
#Right now the order in which you define these matters
#In version 1: Pixels with multiple events are not separated out
datamerged_FIXED$CEOreadable_v1 <- ifelse(datamerged_FIXED$ChangeType.1 == "Degradation" | datamerged_FIXED$ChangeType.2 == "Degradation" | datamerged_FIXED$ChangeType.3 == "Degradation" , 'Degradation',
ifelse(datamerged_FIXED$ChangeType.1 == "Deforestation"| datamerged_FIXED$ChangeType.2 == "Deforestation" | datamerged_FIXED$ChangeType.3 == "Deforestation", 'Deforestation',
ifelse(datamerged_FIXED$ChangeType.1 == "Reforestation"| datamerged_FIXED$ChangeType.2 == "Reforestation" | datamerged_FIXED$ChangeType.3 == "Reforestation", 'Reforestation',
ifelse(datamerged_FIXED$forest.change.event == "N/A non-forest entire time", "stable non forest",
ifelse(datamerged_FIXED$forest.change.event == "no", "stable forest", 'NotReviewed')))))
table(datamerged_FIXED$CEOreadable_v1)
write.csv(datamerged_FIXED, file = 'Results\\Philippines_Test1.csv', row.names = F)
############Set up clean CEO labels - Version 2
#In version 2: Pixels with multiple events ARE separated out
'%!in%' <- Negate('%in%')
datamerged_FIXED$CEOreadable_v2 <- ifelse(datamerged_FIXED$ChangeType.1 == "Degradation" & datamerged_FIXED$ChangeType.2 %!in% c("Degradation","Deforestation","Regeneration"), 'Degradation',
ifelse(datamerged_FIXED$ChangeType.1 == "Deforestation" & datamerged_FIXED$ChangeType.2 %!in% c("Degradation","Deforestation","Regeneration"), 'Deforestation',
ifelse(datamerged_FIXED$ChangeType.1 == "Reforestation" & datamerged_FIXED$ChangeType.2 %!in% c("Degradation","Deforestation","Regeneration"), 'Reforestation',
ifelse(datamerged_FIXED$morethan3.forest.changes == "no", 'multiple events ecologically possible',
ifelse(datamerged_FIXED$morethan3.forest.changes == "yes", 'multiple events noise',
ifelse(datamerged_FIXED$ChangeType.2 %in% c("Degradation","Deforestation","Regeneration") & datamerged_FIXED$third.forest.change.event == "no", 'multiple events ecologically possible',
ifelse(datamerged_FIXED$forest.change.event == "N/A non-forest entire time", "stable non forest",
ifelse(datamerged_FIXED$forest.change.event == "no", "stable forest", 'NotReviewed'))))))))
table(datamerged_FIXED$CEOreadable_v2)
write.csv(datamerged_FIXED, file = 'Results\\Philippines_Test2.csv', row.names = F)
############Set up clean CEO labels - Version 3
#In version 3: Pixels with multiple events are combined
datamerged_FIXED$CEOreadable_v3 <- ifelse(datamerged_FIXED$ChangeType.1 == "Degradation" & datamerged_FIXED$ChangeType.2 %!in% c("Degradation","Deforestation","Regeneration"), 'Degradation',
ifelse(datamerged_FIXED$ChangeType.1 == "Deforestation" & datamerged_FIXED$ChangeType.2 %!in% c("Degradation","Deforestation","Regeneration"), 'Deforestation',
ifelse(datamerged_FIXED$ChangeType.1 == "Reforestation" & datamerged_FIXED$ChangeType.2 %!in% c("Degradation","Deforestation","Regeneration"), 'Reforestation',
ifelse(datamerged_FIXED$morethan3.forest.changes == "no", 'multiple events',
ifelse(datamerged_FIXED$morethan3.forest.changes == "yes", 'multiple events',
ifelse(datamerged_FIXED$ChangeType.2 %in% c("Degradation","Deforestation","Regeneration") & datamerged_FIXED$third.forest.change.event == "no", 'multiple events',
ifelse(datamerged_FIXED$forest.change.event == "N/A non-forest entire time", "stable non forest",
ifelse(datamerged_FIXED$forest.change.event == "no", "stable forest", 'NotReviewed'))))))))
table(datamerged_FIXED$CEOreadable_v3)
write.csv(datamerged_FIXED, file = 'Results\\Philippines_Test3.csv', row.names = F)
############Set up clean CEO labels - Version 4
#In version 3: Pixels with multiple events are combined, agroforestry pulled out
datamerged_FIXED$CEOreadable_v4 <- ifelse(datamerged_FIXED$ChangeType.1 == "Degradation" & datamerged_FIXED$ChangeType.2 %!in% c("Degradation","Deforestation","Regeneration"), 'Degradation',
ifelse(datamerged_FIXED$ChangeType.1 == "Deforestation" & datamerged_FIXED$ChangeType.2 %!in% c("Degradation","Deforestation","Regeneration"), 'Deforestation',
ifelse(datamerged_FIXED$ChangeType.1 == "Reforestation" & datamerged_FIXED$ChangeType.2 %!in% c("Degradation","Deforestation","Regeneration"), 'Reforestation',
ifelse(datamerged_FIXED$morethan3.forest.changes == "no", 'multiple events',
ifelse(datamerged_FIXED$morethan3.forest.changes == "yes", 'multiple events',
ifelse(datamerged_FIXED$ChangeType.2 %in% c("Degradation","Deforestation","Regeneration") & datamerged_FIXED$third.forest.change.event == "no", 'multiple events',
ifelse(datamerged_FIXED$forest.change.event == "N/A non-forest entire time" & datamerged_FIXED$Crop.Type.2000 %in% c("coconut / other palm","unsure","fruit trees (mango, cashew, avocado, rambutan durian)","banana"), "stable nonforest Agroforestry",
ifelse(datamerged_FIXED$forest.change.event == "N/A non-forest entire time" & datamerged_FIXED$Crop.Type.2000 %!in% c("coconut / other palm","unsure","fruit trees (mango, cashew, avocado, rambutan durian)","banana"), "stable nonforest",
ifelse(datamerged_FIXED$forest.change.event == "no", "stable forest", 'NotReviewed')))))))))
table(datamerged_FIXED$CEOreadable_v4)
write.csv(datamerged_FIXED, file = 'Results\\Philippines_Test4.csv', row.names = F)
#############################################################
#############################################################
# ANALYSIS
#############################################################
#############################################################
head(datamerged_FIXED)
#cross tab of original strata to agroforestry removed strata
table(datamerged_FIXED$strata.name, datamerged_FIXED$CEOreadable_v4)
table_maporig_ceov4 <- table(datamerged_FIXED$strata.name, datamerged_FIXED$CEOreadable_v4)
write.csv(table_maporig_ceov4, file = 'Results\\CrossTable_maporigstrata_ceov4.csv', row.names = T)
table(datamerged_FIXED$pixel.count,datamerged_FIXED$strata.name)
#cross tab of simplified mapv3 and ceo v4 agroforestry removed strata
table(datamerged_FIXED$ReadableChangeStrata_Map_v3, datamerged_FIXED$CEOreadable_v4)
table_mapv3_ceov4 <- table(datamerged_FIXED$ReadableChangeStrata_Map_v3, datamerged_FIXED$CEOreadable_v4)
write.csv(table_mapv3_ceov4, file = 'Results\\CrossTable_mapv3_ceov4_simple.csv', row.names = T)
#cross tab of strata v2
table(datamerged_FIXED$ReadableChangeStrata_Map_v2, datamerged_FIXED$CEOreadable_v2)
table_mapv2_CEOv2 <- table(datamerged_FIXED$ReadableChangeStrata_Map_v2, datamerged_FIXED$CEOreadable_v2)
head(strataAreas)
#cross tab of strata v3
table(datamerged_FIXED$ReadableChangeStrata_Map_v3, datamerged_FIXED$CEOreadable_v3)
table_mapv3_CEOv3 <- table(datamerged_FIXED$ReadableChangeStrata_Map_v3, datamerged_FIXED$CEOreadable_v3)
write.csv(table_mapv3_CEOv3, file = 'Results\\CrossTable_mapv3_ceov3.csv', row.names = T)
#cross tab of strata v4
table(datamerged_FIXED$ReadableChangeStrata_Map_v3, datamerged_FIXED$CEOreadable_v4)
table_mapv3_CEOv4 <- table(datamerged_FIXED$ReadableChangeStrata_Map_v3, datamerged_FIXED$CEOreadable_v4)
write.csv(table_mapv3_CEOv4, file = 'Results\\CrossTable_mapv3_ceov4.csv', row.names = T)
###########label the points that we want to review in CEO
datamerged_FIXED$CEOreviewQAQC <-"No"
datamerged_FIXED$CEOreviewQAQC <- ifelse(datamerged_FIXED$ReadableChangeStrata_Map_v3 == "multiple events" & datamerged_FIXED$CEOreadable_v4 == "Deforestation", 'LabelLoss-MapMulti', #9
ifelse(datamerged_FIXED$ReadableChangeStrata_Map_v3 == "Reforestation" & datamerged_FIXED$CEOreadable_v4 == "Deforestation", 'LabelLoss-MapReforest', #2
ifelse(datamerged_FIXED$ReadableChangeStrata_Map_v3 == "stable forest" & datamerged_FIXED$CEOreadable_v4 == "Deforestation", 'LabelLoss-MapForest', #10
ifelse(datamerged_FIXED$ReadableChangeStrata_Map_v3 == "stable non forest" & datamerged_FIXED$CEOreadable_v4 == "Deforestation", 'LabelLoss-MapNonForest', #5
ifelse(datamerged_FIXED$ReadableChangeStrata_Map_v3 == "Reforestation" & datamerged_FIXED$CEOreadable_v4 == "Degradation", 'LabelDeg-MapReforest', #4
ifelse(datamerged_FIXED$ReadableChangeStrata_Map_v3 == "Deforestation" & datamerged_FIXED$CEOreadable_v4 == "Reforestation", 'LabelReforest-MapLoss', #4
ifelse(datamerged_FIXED$ReadableChangeStrata_Map_v3 == "Deforestation" & datamerged_FIXED$CEOreadable_v4 == "stable forest", 'LabelForest-MapLoss', #24
ifelse(datamerged_FIXED$ReadableChangeStrata_Map_v3 == "Reforestation" & datamerged_FIXED$CEOreadable_v4 == "stable forest", 'LabelForest-MapReforest', #31
ifelse(datamerged_FIXED$ReadableChangeStrata_Map_v3 == "multiple events" & datamerged_FIXED$CEOreadable_v4 == "stable forest", 'LabelForest-MapMulti','No'))))))))) #26
table(datamerged_FIXED$CEOreviewQAQC)
write.csv(datamerged_FIXED, file = 'Results\\LabeledCSV_CEOtoReview.csv', row.names = T)
########select nonforest labeled points for review
datamerged_FIXED$CEOreviewQAQC_nonforestlabels <- ifelse(datamerged_FIXED$ReadableChangeStrata_Map_v3 == "Deforestation" & datamerged_FIXED$CEOreadable_v4 == "stable nonforest", 'LabelNonForest-MapLoss',
ifelse(datamerged_FIXED$ReadableChangeStrata_Map_v3 == "multiple events" & datamerged_FIXED$CEOreadable_v4 == "stable nonforest", 'LabelNonForest-MapMulti',
ifelse(datamerged_FIXED$ReadableChangeStrata_Map_v3 == "Reforestation" & datamerged_FIXED$CEOreadable_v4 == "stable nonforest", 'LabelNonForest-MapReforest', 'no')))
table(datamerged_FIXED$CEOreviewQAQC_nonforestlabels)
########select mixednoise mapped points for review
datamerged_FIXED$CEOreviewQAQC_mappednoise <- ifelse(datamerged_FIXED$strata.name == "multiple events noise" & datamerged_FIXED$CEOreadable_v4 == "Degradation", 'LabelDegradation-MapMulti',
ifelse(datamerged_FIXED$strata.name == "multiple events noise" & datamerged_FIXED$CEOreadable_v4 == "Reforestation", 'LabelReforestation-MapMulti',
ifelse(datamerged_FIXED$strata.name == "multiple events noise" & datamerged_FIXED$CEOreadable_v4 == "multiple events", 'LabelMulti-MapMulti',
ifelse(datamerged_FIXED$strata.name == "multiple events noise" & datamerged_FIXED$CEOreadable_v4 == "Deforestation", 'LabelDeforestation-MapMulti',
ifelse(datamerged_FIXED$strata.name == "multiple events noise" & datamerged_FIXED$CEOreadable_v4 == "stable forest", 'LabelForest-MapMulti',
ifelse(datamerged_FIXED$strata.name == "multiple events noise" & datamerged_FIXED$CEOreadable_v4 == "stable nonforest", 'LabelNonforest-MapMulti',
ifelse(datamerged_FIXED$strata.name == "multiple events noise" & datamerged_FIXED$CEOreadable_v4 == "stable nonforest Agroforestry", 'LabelPerennial-MapMulti', 'no')))))))
table(datamerged_FIXED$CEOreviewQAQC_mappednoise)
write.csv(datamerged_FIXED, file = 'Results\\LabeledCSV_CEOtoReview_mappednoise.csv', row.names = F)
########select labeled perennial points for review
datamerged_FIXED$CEOreviewQAQC_labeledperennial <- ifelse(datamerged_FIXED$strata.name == "reforested epoch 1" & datamerged_FIXED$CEOreadable_v4 == "stable nonforest Agroforestry", 'LabelPerennial-MapREF1',
ifelse(datamerged_FIXED$strata.name == "reforested epoch 2 & 3" & datamerged_FIXED$CEOreadable_v4 == "stable nonforest Agroforestry", 'LabelPerennial-MapREF23',
ifelse(datamerged_FIXED$strata.name == "deforested epoch 1" & datamerged_FIXED$CEOreadable_v4 == "stable nonforest Agroforestry", 'LabelPerennial-MapDEF1',
ifelse(datamerged_FIXED$strata.name == "deforested epoch 2 & 3" & datamerged_FIXED$CEOreadable_v4 == "stable nonforest Agroforestry", 'LabelPerennial-MapDEF23',
ifelse(datamerged_FIXED$strata.name == "multiple events ecologically possible" & datamerged_FIXED$CEOreadable_v4 == "stable nonforest Agroforestry", 'LabelPerennial-MapMulti',
ifelse(datamerged_FIXED$strata.name == "multiple events noise" & datamerged_FIXED$CEOreadable_v4 == "stable nonforest Agroforestry", 'LabelPerennial-MapMultiNoise',
ifelse(datamerged_FIXED$strata.name == "stable forest" & datamerged_FIXED$CEOreadable_v4 == "stable nonforest Agroforestry", 'LabelPerennial-MapFOREST',
ifelse(datamerged_FIXED$strata.name == "stable non forest" & datamerged_FIXED$CEOreadable_v4 == "stable nonforest Agroforestry", 'LabelPerennial-MapNONFOREST', 'no'))))))))
table(datamerged_FIXED$CEOreviewQAQC_labeledperennial)
write.csv(datamerged_FIXED, file = 'Results\\USETHIS4CEO_LabeledPerennial_CEOtoReview.csv', row.names = F)
table(duplicated(datamerged_FIXED[c("lon","lat")]))
table(duplicated(datamerged_FIXED$lon))
table(duplicated(datamerged_FIXED$lat))
#########################################
## Set up sample design
#########################################
strat_design <- svydesign(id = ~1, strata = ~ReadableChangeStrata_Map_v1, fpc = ~pixel.count,
data = datamerged_FIXED)
########################################
## once sample design is set up you can analyze the data
#########################################
## survey total (svytotal) calculates area weighted totals of data
?svydesign()
activityData <- svytotal(~CEOreadable_v4, strat_design)
activityData
Change<-as.data.frame(activityData)
colnames(Change)<-c('Total, pixels','SE, pixels')
Change
rownames(Change)<-c("Deforestation",
"Degradation",
"multiple events",
"Reforestation",
"stable forest",
"stable non-forest",
"stable non-forest agroforestry")
Change
## convert to ha
Change<-Change* 30 * 30 / 10000
Change
Change<-round(Change, digits = 0)
Change
colnames(Change)<-c('Total, ha','SE, ha')
Change
#######
## write results #########
write.csv(Change, file = 'Results\\AreasofDisturbance_ceoV4version_SAVE.csv', row.names = T)
###########################################################################
############################################################################
###########################################################################
############################################################################
##After review there were a few points that were double checked because
##there were more off-diagonal points than were expected in the confusion matrix
##Below is the updated analysis with those points altered
datamerged_FIXED_v2 <- read.csv('C:\\Users\\cryst\\OneDrive\\Documents\\Philippines\\PhilippinesQAQCanalysis\\data\\ceo-Philippines_QAQCReview_MapInterpreterDisagreement-sample-data-FIXED.csv')
colnames(datamerged_FIXED_v2)
datamerged_FIXED_v2 <- datamerged_FIXED_v2[-c(1,3:80)]
colnames(datamerged_FIXED_v2)
colnames(datamerged_FIXED)
head(datamerged_FIXED$sampleid)
head(datamerged_FIXED_v2$sampleid)
colnames(datamerged_FIXED_v2)[7]<-"Year.of.first.change.b"
colnames(datamerged_FIXED_v2)[12]<-"Year.of.second.change.b"
colnames(datamerged_FIXED_v2)[19]<-"Year.of.third.change.b"
colnames(datamerged_FIXED_v2)[28]<-"confidenceb"
colnames(datamerged_FIXED_v2)[29]<-"confidence.reasoningb"
colnames(datamerged_FIXED_v2)[2]<-"LC2000b"
colnames(datamerged_FIXED_v2)[3]<-"Forest.Type.2000b"
colnames(datamerged_FIXED_v2)[4]<-"NonForest.Type.2000b"
colnames(datamerged_FIXED_v2)[5]<-"Crop.Type.2000b"
colnames(datamerged_FIXED_v2)[23]<-"LC2018endb"
colnames(datamerged_FIXED_v2)[6]<-"forest.change.eventb"
colnames(datamerged_FIXED_v2)[20]<-"ChangeType.1b"
colnames(datamerged_FIXED_v2)[22]<-"Degradation.Driver.1b"
colnames(datamerged_FIXED_v2)[21]<-"Loss.Driver.1b"
colnames(datamerged_FIXED_v2)[8]<-"second.forest.change.eventb"
colnames(datamerged_FIXED_v2)[9]<-"ChangeType.2b"
colnames(datamerged_FIXED_v2)[10]<-"Degradation.Driver.2b"
colnames(datamerged_FIXED_v2)[11]<-"Loss.Driver.2b"
colnames(datamerged_FIXED_v2)[13]<-"third.forest.change.eventb"
colnames(datamerged_FIXED_v2)[14]<-"ChangeType.3b"
colnames(datamerged_FIXED_v2)[16]<-"Degradation.Driver.3b"
colnames(datamerged_FIXED_v2)[15]<-"Loss.Driver.3b"
colnames(datamerged_FIXED_v2)[17]<-"morethan3.forest.changesb"
colnames(datamerged_FIXED_v2)[18]<-"describe.extra.changesb"
colnames(datamerged_FIXED_v2)[24]<-"Forest.Type.2018b"
colnames(datamerged_FIXED_v2)[25]<-"NonForest.Type.2018b"
colnames(datamerged_FIXED_v2)[26]<-"Crop.Type.2018b"
colnames(datamerged_FIXED_v2)[27]<-"mixed.lc.pixelb"
colnames(datamerged_FIXED_v2)
dim(datamerged_FIXED)
FINALDATASET <- merge(datamerged_FIXED, datamerged_FIXED_v2, by.x = c("sampleid"), by.y = c("sampleid"), all.x = T)
dim(FINALDATASET)
colnames(FINALDATASET)
head(FINALDATASET)
####Fill in all the values for the rows that were not reviewed with the original answers
FINALDATASET$LC2000b <- ifelse(is.na(FINALDATASET$LC2000b), FINALDATASET$LC2000, FINALDATASET$LC2000b)
FINALDATASET$Forest.Type.2000b <- ifelse(is.na(FINALDATASET$Forest.Type.2000b), FINALDATASET$Forest.Type.2000, FINALDATASET$Forest.Type.2000b)
FINALDATASET$NonForest.Type.2000b <- ifelse(is.na(FINALDATASET$NonForest.Type.2000b), FINALDATASET$NonForest.Type.2000, FINALDATASET$NonForest.Type.2000b)
FINALDATASET$Crop.Type.2000b <- ifelse(is.na(FINALDATASET$Crop.Type.2000b), FINALDATASET$Crop.Type.2000, FINALDATASET$Crop.Type.2000b)
FINALDATASET$forest.change.eventb <- ifelse(is.na(FINALDATASET$forest.change.eventb), FINALDATASET$forest.change.event, FINALDATASET$forest.change.eventb)
FINALDATASET$Year.of.first.change.b <- ifelse(is.na(FINALDATASET$Year.of.first.change.b), FINALDATASET$Year.of.first.change., FINALDATASET$Year.of.first.change.b)
FINALDATASET$second.forest.change.eventb <- ifelse(is.na(FINALDATASET$second.forest.change.eventb), FINALDATASET$second.forest.change.event, FINALDATASET$second.forest.change.eventb)
FINALDATASET$ChangeType.2b <- ifelse(is.na(FINALDATASET$ChangeType.2b), FINALDATASET$ChangeType.2, FINALDATASET$ChangeType.2b)
FINALDATASET$Degradation.Driver.2b <- ifelse(is.na(FINALDATASET$Degradation.Driver.2b), FINALDATASET$Degradation.Driver.2, FINALDATASET$Degradation.Driver.2b)
FINALDATASET$Loss.Driver.2b <- ifelse(is.na(FINALDATASET$Loss.Driver.2b), FINALDATASET$Loss.Driver.2, FINALDATASET$Loss.Driver.2b)
FINALDATASET$Year.of.second.change.b <- ifelse(is.na(FINALDATASET$Year.of.second.change.b), FINALDATASET$Year.of.second.change., FINALDATASET$Year.of.second.change.b)
FINALDATASET$third.forest.change.eventb <- ifelse(is.na(FINALDATASET$third.forest.change.eventb), FINALDATASET$third.forest.change.event, FINALDATASET$third.forest.change.eventb)
FINALDATASET$ChangeType.3b <- ifelse(is.na(FINALDATASET$ChangeType.3b), FINALDATASET$ChangeType.3, FINALDATASET$ChangeType.3b)
FINALDATASET$Loss.Driver.3b <- ifelse(is.na(FINALDATASET$Loss.Driver.3b), FINALDATASET$Loss.Driver.3, FINALDATASET$Loss.Driver.3b)
FINALDATASET$Degradation.Driver.3b <- ifelse(is.na(FINALDATASET$Degradation.Driver.3b), FINALDATASET$Degradation.Driver.3, FINALDATASET$Degradation.Driver.3b)
FINALDATASET$morethan3.forest.changesb <- ifelse(is.na(FINALDATASET$morethan3.forest.changesb), FINALDATASET$morethan3.forest.changes, FINALDATASET$morethan3.forest.changesb)
FINALDATASET$describe.extra.changesb <- ifelse(is.na(FINALDATASET$describe.extra.changesb), FINALDATASET$describe.extra.changes, FINALDATASET$describe.extra.changesb)
FINALDATASET$Year.of.third.change.b <- ifelse(is.na(FINALDATASET$Year.of.third.change.b), FINALDATASET$Year.of.third.change., FINALDATASET$Year.of.third.change.b)
FINALDATASET$ChangeType.1b <- ifelse(is.na(FINALDATASET$ChangeType.1b), FINALDATASET$ChangeType.1, FINALDATASET$ChangeType.1b)
FINALDATASET$Loss.Driver.1b <- ifelse(is.na(FINALDATASET$Loss.Driver.1b), FINALDATASET$Loss.Driver.1, FINALDATASET$Loss.Driver.1b)
FINALDATASET$Degradation.Driver.1b <- ifelse(is.na(FINALDATASET$Degradation.Driver.1b), FINALDATASET$Degradation.Driver.1, FINALDATASET$Degradation.Driver.1b)
FINALDATASET$LC2018endb <- ifelse(is.na(FINALDATASET$LC2018endb), FINALDATASET$LC2018end, FINALDATASET$LC2018endb)
FINALDATASET$Forest.Type.2018b <- ifelse(is.na(FINALDATASET$Forest.Type.2018b), FINALDATASET$Forest.Type.2018, FINALDATASET$Forest.Type.2018b)
FINALDATASET$NonForest.Type.2018b <- ifelse(is.na(FINALDATASET$NonForest.Type.2018b), FINALDATASET$NonForest.Type.2018, FINALDATASET$NonForest.Type.2018b)
FINALDATASET$Crop.Type.2018b <- ifelse(is.na(FINALDATASET$Crop.Type.2018b), FINALDATASET$Crop.Type.2018, FINALDATASET$Crop.Type.2018b)
FINALDATASET$mixed.lc.pixelb <- ifelse(is.na(FINALDATASET$mixed.lc.pixelb), FINALDATASET$mixed.lc.pixel, FINALDATASET$mixed.lc.pixelb)
FINALDATASET$confidenceb <- ifelse(is.na(FINALDATASET$confidenceb), FINALDATASET$confidence, FINALDATASET$confidenceb)
FINALDATASET$confidence.reasoningb <- ifelse(is.na(FINALDATASET$confidence.reasoningb), FINALDATASET$confidence.reasoning, FINALDATASET$confidence.reasoningb)
write.csv(FINALDATASET, file = 'Results\\FINALDATASET_testmerge.csv', row.names = F)
############Set up clean CEO labels - Version 4 NEW
#In version 4: Pixels with multiple events are combined, agroforestry pulled out
FINALDATASET$CEOreadable_v4_NEWb <- ifelse(FINALDATASET$ChangeType.1b == "Degradation" & FINALDATASET$ChangeType.2b %!in% c("Degradation","Deforestation","Regeneration"), 'Degradation',
ifelse(FINALDATASET$ChangeType.1b == "Deforestation" & FINALDATASET$ChangeType.2b %!in% c("Degradation","Deforestation","Regeneration"), 'Deforestation',
ifelse(FINALDATASET$ChangeType.1b == "Reforestation" & FINALDATASET$ChangeType.2b %!in% c("Degradation","Deforestation","Regeneration"), 'Reforestation',
ifelse(FINALDATASET$morethan3.forest.changesb == "no", 'multiple events',
ifelse(FINALDATASET$morethan3.forest.changesb == "yes", 'multiple events',
ifelse(FINALDATASET$ChangeType.2b %in% c("Degradation","Deforestation","Regeneration") & FINALDATASET$third.forest.change.eventb == "no", 'multiple events',
ifelse(FINALDATASET$forest.change.eventb == "N/A non-forest entire time" & FINALDATASET$Crop.Type.2000b %in% c("coconut / other palm","unsure","fruit trees (mango, cashew, avocado, rambutan durian)","banana"), "stable nonforest Agroforestry",
ifelse(FINALDATASET$forest.change.eventb == "N/A non-forest entire time" & FINALDATASET$Crop.Type.2000b %!in% c("coconut / other palm","unsure","fruit trees (mango, cashew, avocado, rambutan durian)","banana"), "stable nonforest",
ifelse(FINALDATASET$forest.change.eventb == "no", "stable forest", 'NotReviewed')))))))))
table(FINALDATASET$CEOreadable_v4_NEWb)
########Simplified Map data
FINALDATASET$ReadableChangeStrata_Map_v3<-"fixMe"
FINALDATASET$ReadableChangeStrata_Map_v3[FINALDATASET$ChangeStrata_Map == 31]<-"Deforestation"
FINALDATASET$ReadableChangeStrata_Map_v3[FINALDATASET$ChangeStrata_Map == 32]<-"Deforestation"
FINALDATASET$ReadableChangeStrata_Map_v3[FINALDATASET$ChangeStrata_Map == 41]<-"Reforestation"
FINALDATASET$ReadableChangeStrata_Map_v3[FINALDATASET$ChangeStrata_Map == 42]<-"Reforestation"
FINALDATASET$ReadableChangeStrata_Map_v3[FINALDATASET$ChangeStrata_Map == 50]<-"stable forest"
FINALDATASET$ReadableChangeStrata_Map_v3[FINALDATASET$ChangeStrata_Map == 60]<-"stable non forest"
FINALDATASET$ReadableChangeStrata_Map_v3[FINALDATASET$ChangeStrata_Map == 70]<-"multiple events"
FINALDATASET$ReadableChangeStrata_Map_v3[FINALDATASET$ChangeStrata_Map == 80]<-"multiple events"
unique(FINALDATASET$ReadableChangeStrata_Map_v3)
colnames(FINALDATASET)
###########select multiple events points for review
FINALDATASET$CEOreviewQAQC_multipleevents <- ifelse(FINALDATASET$strata.name == "multiple events ecologically possible" & FINALDATASET$CEOreadable_v4_NEWb == "Deforestation", 'LabelLoss-MapMulti',
ifelse(FINALDATASET$strata.name == "multiple events ecologically possible" & FINALDATASET$CEOreadable_v4_NEWb == "Degradation", 'LabelDeg-MapMulti',
ifelse(FINALDATASET$strata.name == "multiple events ecologically possible" & FINALDATASET$CEOreadable_v4_NEWb == "Reforestation", 'LabelReforest-MapMulti',
ifelse(FINALDATASET$strata.name == "multiple events ecologically possible" & FINALDATASET$CEOreadable_v4_NEWb == "stable forest", 'LabelForest-MapMulti',
ifelse(FINALDATASET$strata.name == "multiple events ecologically possible" & FINALDATASET$CEOreadable_v4_NEWb == "multiple events", 'LabelMulti-MapMulti',
ifelse(FINALDATASET$strata.name == "multiple events ecologically possible" & FINALDATASET$CEOreadable_v4_NEWb == "stable nonforest", 'LabelNonforest-MapMulti',
ifelse(FINALDATASET$strata.name == "multiple events ecologically possible" & FINALDATASET$CEOreadable_v4_NEWb == "stable nonforest Agroforestry", 'LabelAgroforest-MapMulti','No')))))))
table(FINALDATASET$CEOreviewQAQC_multipleevents)
write.csv(FINALDATASET, file = 'Results\\CEOreviewQAQC_multipleevents.csv', row.names = T)
###############################################
#######See how much review agreed with original interpretations
FINALDATASET$reviewagreementrate <- ifelse(FINALDATASET$CEOreadable_v4 == FINALDATASET$CEOreadable_v4_NEWb, 'Agree',
ifelse(FINALDATASET$CEOreadable_v4 != FINALDATASET$CEOreadable_v4_NEWb, 'Dis','Error'))
table(FINALDATASET$reviewagreementrate)
write.csv(FINALDATASET, file = 'Results\\FINALDATASET_useforreview.csv', row.names = F)
#96 points were reviewed
#48 points = 'Dis', so 50% of the points reviewed had their interpretation changed
table(FINALDATASET$CEOreadable_v4,FINALDATASET$CEOreadable_v4_NEWb)
table_compare_SMEpart1_toorig <- table(FINALDATASET$CEOreadable_v4,FINALDATASET$CEOreadable_v4_NEWb)
write.csv(table_compare_SMEpart1_toorig, file = 'Results\\table_compare_SMEpart1_toorig.csv', row.names = T)
##########################################################################################
##########################################################################################
## ANALYSIS REDO
##########################################################################################
##########################################################################################
#cross tab of simplified mapv3 and ceo v4 agroforestry removed strata
table(FINALDATASET$ReadableChangeStrata_Map_v3, FINALDATASET$CEOreadable_v4_NEWb)
table_mapv3_ceov4_NEW <- table(FINALDATASET$ReadableChangeStrata_Map_v3, FINALDATASET$CEOreadable_v4_NEWb)
write.csv(table_mapv3_ceov4_NEW, file = 'Results\\CrossTable_mapv3_ceov4_simple_NEW.csv', row.names = T)
#cross tab of original strata to agroforestry removed strata, updated
table(FINALDATASET$strata.name, FINALDATASET$CEOreadable_v4_NEWb)
table_maporig_ceov4_NEW <- table(FINALDATASET$strata.name, FINALDATASET$CEOreadable_v4_NEWb)
write.csv(table_maporig_ceov4_NEW, file = 'Results\\CrossTable_maporigstrata_ceov4_NEW.csv', row.names = T)
#########################################
## Set up sample design
#########################################
strat_design <- svydesign(id = ~1, strata = ~ReadableChangeStrata_Map_v1, fpc = ~pixel.count,
data = FINALDATASET)
########################################
## once sample design is set up you can analyze the data
#########################################
## survey total (svytotal) calculates area weighted totals of data
?svydesign()
activityData <- svytotal(~CEOreadable_v4_NEWb, strat_design)
activityData
Change<-as.data.frame(activityData)
colnames(Change)<-c('Total, pixels','SE, pixels')
Change
rownames(Change)<-c("Deforestation",
"Degradation",
"multiple events",
"Reforestation",
"stable forest",
"stable non-forest",
"stable non-forest agroforestry")
Change
## convert to ha
Change<-Change* 30 * 30 / 10000
Change
Change<-round(Change, digits = 0)
Change
colnames(Change)<-c('Total, ha','SE, ha')
Change
#######
## write results #########
write.csv(Change, file = 'Results\\AreasofDisturbance_ceoV4version_SAVE_NEW.csv', row.names = T)