################################################################################################## #Code supporting submitted paper 'Global decline in subsistence-oriented and smallholder fire use' ################################################################################################## #####The excel file 'practices_r.xlsx' includes just the 'practices' tab from the LIFE database (supplementary data) #install.packages("stringr") #install.packages("tidyverse") #install.packages(c("cowplot", "googleway", "ggplot2", "ggrepel", "ggspatial", "libwgeom", "sf", "rnaturalearth", "rnaturalearthdata")) #install.packages("dplyr") #install.packages("rgdal") #install.packages("raster") #install.packages("ggsn") #install.packages("rworldmap") #install.packages("wesanderson") #install.packages("gridExtra")' #install.packages("sjmisc") library(tidyverse) library(ggplot2) library(readxl) library(rworldmap) library(wesanderson) library(data.table) library(gridExtra) library(sjmisc) library(tibble) ########### ########### Import data from excel and read latitude and longitude as numeric ########### practices <- read_excel("practices_r.xlsx") practices$LATITUDE <- as.numeric(as.character(practices$LATITUDE)) practices$LONGITUDE <- as.numeric(as.character(practices$LONGITUDE)) ########### ########### Create subsets of the data by economic / livelihood orientation ########### practices$MARS <- str_count(practices$MAR,"S") practicesMARS <- subset(practices,MARS == 1, select = c(FID:NO)) practices$MARM <- str_count(practices$MAR,"M") practicesMARM <- subset(practices,MARM == 1, select = c(FID:NO)) practices$MARP <- str_count(practices$MAR,"P") practicesMARP <- subset(practices,MARP == 1, select = c(FID:NO)) practices$MARN <- str_count(practices$MAR,"N") practicesMARN <- subset(practices,MARN == 1, select = c(FID:NO)) ########### ########### Create subsets of the data by fire use purpose 2 ########### practices$PU2A1 <- str_count(practices$FUPU2,"A1") practicesPU2A1 <- subset(practices,PU2A1 == 1, select = c(FID:NO)) practices$PU2A2 <- str_count(practices$FUPU2,"A2") practicesPU2A2 <- subset(practices,PU2A2 == 1, select = c(FID:NO)) practices$PU2A3 <- str_count(practices$FUPU2,"A3") practicesPU2A3 <- subset(practices,PU2A3 == 1, select = c(FID:NO)) practices$PU2A4 <- str_count(practices$FUPU2,"A4") practicesPU2A4 <- subset(practices,PU2A4 == 1, select = c(FID:NO)) practices$PU2A5 <- str_count(practices$FUPU2,"A5") practicesPU2A5 <- subset(practices,PU2A5 == 1, select = c(FID:NO)) practices$PU2P1 <- str_count(practices$FUPU2,"P1") practicesPU2P1 <- subset(practices,PU2P1 == 1, select = c(FID:NO)) practices$PU2P2 <- str_count(practices$FUPU2,"P2") practicesPU2P2 <- subset(practices,PU2P2 == 1, select = c(FID:NO)) practices$PU2P3 <- str_count(practices$FUPU2,"P3") practicesPU2P3 <- subset(practices,PU2P3 == 1, select = c(FID:NO)) practices$PU2P4 <- str_count(practices$FUPU2,"P4") practicesPU2P4 <- subset(practices,PU2P4 == 1, select = c(FID:NO)) practices$PU2HF1 <- str_count(practices$FUPU2,"HF1") practicesPU2HF1 <- subset(practices,PU2HF1 == 1, select = c(FID:NO)) practices$PU2HF2 <- str_count(practices$FUPU2,"HF2") practicesPU2HF2 <- subset(practices,PU2HF2 == 1, select = c(FID:NO)) practices$PU2HF3 <- str_count(practices$FUPU2,"HF3") practicesPU2HF3 <- subset(practices,PU2HF3 == 1, select = c(FID:NO)) practices$PU2HF4 <- str_count(practices$FUPU2,"HF4") practicesPU2HF4 <- subset(practices,PU2HF4 == 1, select = c(FID:NO)) practices$PU2HF5 <- str_count(practices$FUPU2,"HF5") practicesPU2HF5 <- subset(practices,PU2HF5 == 1, select = c(FID:NO)) practices$PU2G1 <- str_count(practices$FUPU2,"G1") practicesPU2G1 <- subset(practices,PU2G1 == 1, select = c(FID:NO)) practices$PU2G2 <- str_count(practices$FUPU2,"G2") practicesPU2G2 <- subset(practices,PU2G2 == 1, select = c(FID:NO)) practices$PU2G3 <- str_count(practices$FUPU2,"G3") practicesPU2G3 <- subset(practices,PU2G3 == 1, select = c(FID:NO)) practices$PU2C1 <- str_count(practices$FUPU2,"C1") practicesPU2C1 <- subset(practices,PU2C1 == 1, select = c(FID:NO)) practices$PU2C2 <- str_count(practices$FUPU2,"C2") practicesPU2C2 <- subset(practices,PU2C2 == 1, select = c(FID:NO)) practices$PU2M1 <- str_count(practices$FUPU2,"M1") practicesPU2M1 <- subset(practices,PU2M1 == 1, select = c(FID:NO)) practices$PU2HW1 <- str_count(practices$FUPU2,"HW1") practicesPU2HW1 <- subset(practices,PU2HW1 == 1, select = c(FID:NO)) practices$PU2HW2 <- str_count(practices$FUPU2,"HW2") practicesPU2HW2 <- subset(practices,PU2HW2 == 1, select = c(FID:NO)) practices$PU2HW3 <- str_count(practices$FUPU2,"HW3") practicesPU2HW3 <- subset(practices,PU2HW3 == 1, select = c(FID:NO)) practices$PU2HW4 <- str_count(practices$FUPU2,"HW4") practicesPU2HW4 <- subset(practices,PU2HW4 == 1, select = c(FID:NO)) practices$PU2HW5 <- str_count(practices$FUPU2,"HW5") practicesPU2HW5 <- subset(practices,PU2HW5 == 1, select = c(FID:NO)) practices$PU2S1 <- str_count(practices$FUPU2,"S1") practicesPU2S1 <- subset(practices,PU2S1 == 1, select = c(FID:NO)) practices$PU2S2 <- str_count(practices$FUPU2,"S2") practicesPU2S2 <- subset(practices,PU2S2 == 1, select = c(FID:NO)) practices$PU2S3 <- str_count(practices$FUPU2,"S3") practicesPU2S3 <- subset(practices,PU2S3 == 1, select = c(FID:NO)) practices$PU2S4 <- str_count(practices$FUPU2,"S4") practicesPU2S4 <- subset(practices,PU2S4 == 1, select = c(FID:NO)) ########### ########### Binomial tests of trend in fire practices, by purpose 2 and economic / livelihood orientation ########### practicesPU2A1STPIDL <- practicesPU2A1%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2A1STAIDL <- practicesPU2A1%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2A1STFIDL <- practicesPU2A1%>% filter(STF == "I" | STF == "D" | STF == "L") #A1 test for STP - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2A1STPIDL[,39],"I")),length(practicesPU2A1STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #A1 test for STA - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2A1STAIDL[,40],"I")),length(practicesPU2A1STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #A1 test for STF - SIGNIFICANTLY INCREASING binom.test((str_count(practicesPU2A1STFIDL[,41],"I")),length(practicesPU2A1STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2A2STPIDL <- practicesPU2A2%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2A2STAIDL <- practicesPU2A2%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2A2STFIDL <- practicesPU2A2%>% filter(STF == "I" | STF == "D" | STF == "L") #A2 test for STP - SIGNIFICANTLY INCREASING binom.test((str_count(practicesPU2A2STPIDL[,39],"I")),length(practicesPU2A2STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #A2 test for STA - SIGNIFICANTLY INCREASING binom.test((str_count(practicesPU2A2STAIDL[,40],"I")),length(practicesPU2A2STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #A2 test for STF - INSIGNIFICANT binom.test((str_count(practicesPU2A2STFIDL[,41],"I")),length(practicesPU2A2STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2A3STPIDL <- practicesPU2A3%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2A3STAIDL <- practicesPU2A3%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2A3STFIDL <- practicesPU2A3%>% filter(STF == "I" | STF == "D" | STF == "L") #A3 test for STP - INSIGNIFICANT binom.test((str_count(practicesPU2A3STPIDL[,39],"I")),length(practicesPU2A3STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #A3 test for STA - INSIGNIFICANT binom.test((str_count(practicesPU2A3STAIDL[,40],"I")),length(practicesPU2A3STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #A3 test for STF - INSIGNIFICANT binom.test((str_count(practicesPU2A3STFIDL[,41],"I")),length(practicesPU2A3STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2A4STPIDL <- practicesPU2A4%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2A4STAIDL <- practicesPU2A4%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2A4STFIDL <- practicesPU2A4%>% filter(STF == "I" | STF == "D" | STF == "L") #A4 test for STP - INSIGNIFICANT binom.test((str_count(practicesPU2A4STPIDL[,39],"I")),length(practicesPU2A4STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #A4 test for STA - INSIGNIFICANT binom.test((str_count(practicesPU2A4STAIDL[,40],"I")),length(practicesPU2A4STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #A4 test for STF - INSIGNIFICANT binom.test((str_count(practicesPU2A4STFIDL[,41],"I")),length(practicesPU2A4STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2A5STPIDL <- practicesPU2A5%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2A5STAIDL <- practicesPU2A5%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2A5STFIDL <- practicesPU2A5%>% filter(STF == "I" | STF == "D" | STF == "L") #A5 test for STP - INSIGNIFICANT binom.test((str_count(practicesPU2A5STPIDL[,39],"I")),length(practicesPU2A5STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #A5 test for STA - INSIGNIFICANT binom.test((str_count(practicesPU2A5STAIDL[,40],"I")),length(practicesPU2A5STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #A5 test for STF - INSIGNIFICANT binom.test((str_count(practicesPU2A5STFIDL[,41],"I")),length(practicesPU2A5STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2P1STPIDL <- practicesPU2P1%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2P1STAIDL <- practicesPU2P1%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2P1STFIDL <- practicesPU2P1%>% filter(STF == "I" | STF == "D" | STF == "L") #P1 test for STP - INSIGNIFICANT binom.test((str_count(practicesPU2P1STPIDL[,39],"I")),length(practicesPU2P1STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #P1 test for STA - INSIGNIFICANT binom.test((str_count(practicesPU2P1STAIDL[,40],"I")),length(practicesPU2P1STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #P1 test for STF - INSIGNIFICANT binom.test((str_count(practicesPU2P1STFIDL[,41],"I")),length(practicesPU2P1STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2P2STPIDL <- practicesPU2P2%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2P2STAIDL <- practicesPU2P2%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2P2STFIDL <- practicesPU2P2%>% filter(STF == "I" | STF == "D" | STF == "L") #P2 test for STP - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2P2STPIDL[,39],"I")),length(practicesPU2P2STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #P2 test for STA - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2P2STAIDL[,40],"I")),length(practicesPU2P2STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #P2 test for STF - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2P2STFIDL[,41],"I")),length(practicesPU2P2STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2P3STPIDL <- practicesPU2P3%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2P3STAIDL <- practicesPU2P3%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2P3STFIDL <- practicesPU2P3%>% filter(STF == "I" | STF == "D" | STF == "L") #P3 test for STP - INSIGNIFICANT binom.test((str_count(practicesPU2P3STPIDL[,39],"I")),length(practicesPU2P3STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #P3 test for STA - INSIGNIFICANT binom.test((str_count(practicesPU2P3STAIDL[,40],"I")),length(practicesPU2P3STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #P3 test for STF - INSIGNIFICANT binom.test((str_count(practicesPU2P3STFIDL[,41],"I")),length(practicesPU2P3STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2P4STPIDL <- practicesPU2P4%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2P4STAIDL <- practicesPU2P4%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2P4STFIDL <- practicesPU2P4%>% filter(STF == "I" | STF == "D" | STF == "L") #P4 test for STP - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2P4STPIDL[,39],"I")),length(practicesPU2P4STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #P4 test for STA - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2P4STAIDL[,40],"I")),length(practicesPU2P4STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #P4 test for STF - INSIGNIFICANT binom.test((str_count(practicesPU2P4STFIDL[,41],"I")),length(practicesPU2P4STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2HF1STPIDL <- practicesPU2HF1%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2HF1STAIDL <- practicesPU2HF1%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2HF1STFIDL <- practicesPU2HF1%>% filter(STF == "I" | STF == "D" | STF == "L") #HF1 test for STP - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HF1STPIDL[,39],"I")),length(practicesPU2HF1STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #HF1 test for STA - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HF1STAIDL[,40],"I")),length(practicesPU2HF1STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #HF1 test for STF - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HF1STFIDL[,41],"I")),length(practicesPU2HF1STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2HF2STPIDL <- practicesPU2HF2%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2HF2STAIDL <- practicesPU2HF2%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2HF2STFIDL <- practicesPU2HF2%>% filter(STF == "I" | STF == "D" | STF == "L") #HF2 test for STP - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HF2STPIDL[,39],"I")),length(practicesPU2HF2STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #HF2 test for STA - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HF2STAIDL[,40],"I")),length(practicesPU2HF2STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #HF2 test for STF - INSIGNIFICANT binom.test((str_count(practicesPU2HF2STFIDL[,41],"I")),length(practicesPU2HF2STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2HF3STPIDL <- practicesPU2HF3%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2HF3STAIDL <- practicesPU2HF3%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2HF3STFIDL <- practicesPU2HF3%>% filter(STF == "I" | STF == "D" | STF == "L") #HF3 test for STP - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HF3STPIDL[,39],"I")),length(practicesPU2HF3STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #HF3 test for STA - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HF3STAIDL[,40],"I")),length(practicesPU2HF3STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #HF3 test for STF - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HF3STFIDL[,41],"I")),length(practicesPU2HF3STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2HF4STPIDL <- practicesPU2HF4%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2HF4STAIDL <- practicesPU2HF4%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2HF4STFIDL <- practicesPU2HF4%>% filter(STF == "I" | STF == "D" | STF == "L") #HF4 test for STP - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HF4STPIDL[,39],"I")),length(practicesPU2HF4STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #HF4 test for STA - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HF4STAIDL[,40],"I")),length(practicesPU2HF4STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #HF4 test for STF - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HF4STFIDL[,41],"I")),length(practicesPU2HF4STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2HF5STPIDL <- practicesPU2HF5%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2HF5STAIDL <- practicesPU2HF5%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2HF5STFIDL <- practicesPU2HF5%>% filter(STF == "I" | STF == "D" | STF == "L") #HF5 test for STP - INSIGNIFICANT binom.test((str_count(practicesPU2HF5STPIDL[,39],"I")),length(practicesPU2HF5STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #HF5 test for STA - INSIGNIFICANT binom.test((str_count(practicesPU2HF5STAIDL[,40],"I")),length(practicesPU2HF5STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #HF5 test for STF - INSIGNIFICANT binom.test((str_count(practicesPU2HF5STFIDL[,41],"I")),length(practicesPU2HF5STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2G1STPIDL <- practicesPU2G1%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2G1STAIDL <- practicesPU2G1%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2G1STFIDL <- practicesPU2G1%>% filter(STF == "I" | STF == "D" | STF == "L") #G1 test for STP - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2G1STPIDL[,39],"I")),length(practicesPU2G1STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #G1 test for STA - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2G1STAIDL[,40],"I")),length(practicesPU2G1STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #G1 test for STF - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2G1STFIDL[,41],"I")),length(practicesPU2G1STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2G2STPIDL <- practicesPU2G2%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2G2STAIDL <- practicesPU2G2%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2G2STFIDL <- practicesPU2G2%>% filter(STF == "I" | STF == "D" | STF == "L") #G2 test for STP - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2G2STPIDL[,39],"I")),length(practicesPU2G2STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #G2 test for STA - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2G2STAIDL[,40],"I")),length(practicesPU2G2STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #G2 test for STF - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2G2STFIDL[,41],"I")),length(practicesPU2G2STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2G3STPIDL <- practicesPU2G3%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2G3STAIDL <- practicesPU2G3%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2G3STFIDL <- practicesPU2G3%>% filter(STF == "I" | STF == "D" | STF == "L") #G3 test for STP - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2G3STPIDL[,39],"I")),length(practicesPU2G3STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #G3 test for STA - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2G3STAIDL[,40],"I")),length(practicesPU2G3STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #G3 test for STF - INSIGNIFICANT binom.test((str_count(practicesPU2G3STFIDL[,41],"I")),length(practicesPU2G3STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2C1STPIDL <- practicesPU2C1%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2C1STAIDL <- practicesPU2C1%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2C1STFIDL <- practicesPU2C1%>% filter(STF == "I" | STF == "D" | STF == "L") #C1 test for STP - INSIGNIFICANT binom.test((str_count(practicesPU2C1STPIDL[,39],"I")),length(practicesPU2C1STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #C1 test for STA - INSIGNIFICANT binom.test((str_count(practicesPU2C1STAIDL[,40],"I")),length(practicesPU2C1STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #C1 test for STF - INSIGNIFICANT binom.test((str_count(practicesPU2C1STFIDL[,41],"I")),length(practicesPU2C1STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2C2STPIDL <- practicesPU2C2%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2C2STAIDL <- practicesPU2C2%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2C2STFIDL <- practicesPU2C2%>% filter(STF == "I" | STF == "D" | STF == "L") #C2 test for STP - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2C2STPIDL[,39],"I")),length(practicesPU2C2STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #C2 test for STA - INSIGNIFICANT binom.test((str_count(practicesPU2C2STAIDL[,40],"I")),length(practicesPU2C2STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #C2 test for STF - INSIGNIFICANT binom.test((str_count(practicesPU2C2STFIDL[,41],"I")),length(practicesPU2C2STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2M1STPIDL <- practicesPU2M1%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2M1STAIDL <- practicesPU2M1%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2M1STFIDL <- practicesPU2M1%>% filter(STF == "I" | STF == "D" | STF == "L") #M1 test for STP - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2M1STPIDL[,39],"I")),length(practicesPU2M1STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #M1 test for STA - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2M1STAIDL[,40],"I")),length(practicesPU2M1STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #M1 test for STF - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2M1STFIDL[,41],"I")),length(practicesPU2M1STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2HW1STPIDL <- practicesPU2HW1%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2HW1STAIDL <- practicesPU2HW1%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2HW1STFIDL <- practicesPU2HW1%>% filter(STF == "I" | STF == "D" | STF == "L") #HW1 test for STP - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HW1STPIDL[,39],"I")),length(practicesPU2HW1STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #HW1 test for STA - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HW1STAIDL[,40],"I")),length(practicesPU2HW1STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #HW1 test for STF - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HW1STFIDL[,41],"I")),length(practicesPU2HW1STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2HW2STPIDL <- practicesPU2HW2%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2HW2STAIDL <- practicesPU2HW2%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2HW2STFIDL <- practicesPU2HW2%>% filter(STF == "I" | STF == "D" | STF == "L") #HW2 test for STP - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HW2STPIDL[,39],"I")),length(practicesPU2HW2STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #HW2 test for STA - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HW2STAIDL[,40],"I")),length(practicesPU2HW2STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #HW2 test for STF - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HW2STFIDL[,41],"I")),length(practicesPU2HW2STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2HW3STPIDL <- practicesPU2HW3%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2HW3STAIDL <- practicesPU2HW3%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2HW3STFIDL <- practicesPU2HW3%>% filter(STF == "I" | STF == "D" | STF == "L") #HW3 test for STP - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HW3STPIDL[,39],"I")),length(practicesPU2HW3STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #HW3 test for STA - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HW3STAIDL[,40],"I")),length(practicesPU2HW3STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #HW3 test for STF - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HW3STFIDL[,41],"I")),length(practicesPU2HW3STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2HW4STPIDL <- practicesPU2HW4%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2HW4STAIDL <- practicesPU2HW4%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2HW4STFIDL <- practicesPU2HW4%>% filter(STF == "I" | STF == "D" | STF == "L") #HW4 test for STP - INSIGNIFICANT binom.test((str_count(practicesPU2HW4STPIDL[,39],"I")),length(practicesPU2HW4STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #HW4 test for STA - INSIGNIFICANT binom.test((str_count(practicesPU2HW4STAIDL[,40],"I")),length(practicesPU2HW4STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #HW4 test for STF - INSIGNIFICANT binom.test((str_count(practicesPU2HW4STFIDL[,41],"I")),length(practicesPU2HW4STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2HW5STPIDL <- practicesPU2HW5%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2HW5STAIDL <- practicesPU2HW5%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2HW5STFIDL <- practicesPU2HW5%>% filter(STF == "I" | STF == "D" | STF == "L") #HW5 test for STP - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HW5STPIDL[,39],"I")),length(practicesPU2HW5STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #HW5 test for STA - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2HW5STAIDL[,40],"I")),length(practicesPU2HW5STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #HW5 test for STF - INSIGNIFICANT binom.test((str_count(practicesPU2HW5STFIDL[,41],"I")),length(practicesPU2HW5STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2S1STPIDL <- practicesPU2S1%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2S1STAIDL <- practicesPU2S1%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2S1STFIDL <- practicesPU2S1%>% filter(STF == "I" | STF == "D" | STF == "L") #S1 test for STP - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2S1STPIDL[,39],"I")),length(practicesPU2S1STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #S1 test for STA - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2S1STAIDL[,40],"I")),length(practicesPU2S1STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #S1 test for STF - INSIGNIFICANT binom.test((str_count(practicesPU2S1STFIDL[,41],"I")),length(practicesPU2S1STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2S2STPIDL <- practicesPU2S2%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2S2STAIDL <- practicesPU2S2%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2S2STFIDL <- practicesPU2S2%>% filter(STF == "I" | STF == "D" | STF == "L") #S2 test for STP - SIGNIFICANTLY INCREASING binom.test((str_count(practicesPU2S2STPIDL[,39],"I")),length(practicesPU2S2STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #S2 test for STA - SIGNIFICANTLY INCREASING binom.test((str_count(practicesPU2S2STAIDL[,40],"I")),length(practicesPU2S2STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #S2 test for STF - INSIGNIFICANT binom.test((str_count(practicesPU2S2STFIDL[,41],"I")),length(practicesPU2S2STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2S3STPIDL <- practicesPU2S3%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2S3STAIDL <- practicesPU2S3%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2S3STFIDL <- practicesPU2S3%>% filter(STF == "I" | STF == "D" | STF == "L") #S3 test for STP - INSIGNIFICANT binom.test((str_count(practicesPU2S3STPIDL[,39],"I")),length(practicesPU2S3STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #S3 test for STA - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2S3STAIDL[,40],"I")),length(practicesPU2S3STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #S3 test for STF - INSIGNIFICANT binom.test((str_count(practicesPU2S3STFIDL[,41],"I")),length(practicesPU2S3STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesPU2S4STPIDL <- practicesPU2S4%>% filter(STP == "I" | STP == "D" | STP == "L") practicesPU2S4STAIDL <- practicesPU2S4%>% filter(STA == "I" | STA == "D" | STA == "L") practicesPU2S4STFIDL <- practicesPU2S4%>% filter(STF == "I" | STF == "D" | STF == "L") #S4 test for STP - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2S4STPIDL[,39],"I")),length(practicesPU2S4STPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #S4 test for STA - SIGNIFICANTLY DECREASING binom.test((str_count(practicesPU2S4STAIDL[,40],"I")),length(practicesPU2S4STAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #S4 test for STF - INSIGNIFICANT binom.test((str_count(practicesPU2S4STFIDL[,41],"I")),length(practicesPU2S4STFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesMARMSTPIDL <- practicesMARM%>% filter(STP == "I" | STP == "D" | STP == "L") practicesMARMSTAIDL <- practicesMARM%>% filter(STA == "I" | STA == "D" | STA == "L") practicesMARMSTFIDL <- practicesMARM%>% filter(STF == "I" | STF == "D" | STF == "L") #Market-oriented test for STP - SIGNIFICANTLY INCREASING binom.test((str_count(practicesMARMSTPIDL[,39],"I")),length(practicesMARMSTPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #Market-oriented test for STA - SIGNIFICANTLY INCREASING binom.test((str_count(practicesMARMSTAIDL[,40],"I")),length(practicesMARMSTAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #Market-oriented test for STF - SIGNIFICANTLY INCREASING binom.test((str_count(practicesMARMSTFIDL[,41],"I")),length(practicesMARMSTFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) practicesMARSSTPIDL <- practicesMARS%>% filter(STP == "I" | STP == "D" | STP == "L") practicesMARSSTAIDL <- practicesMARS%>% filter(STA == "I" | STA == "D" | STA == "L") practicesMARSSTFIDL <- practicesMARS%>% filter(STF == "I" | STF == "D" | STF == "L") #Subsistence-oriented test for STP - SIGNIFICANTLY DECREASING binom.test((str_count(practicesMARSSTPIDL[,39],"I")),length(practicesMARSSTPIDL$STP), p=0.5, alternative = "two.sided", conf.level=0.95) #Subsistence-oriented test for STA - SIGNIFICANTLY DECREASING binom.test((str_count(practicesMARSSTAIDL[,40],"I")),length(practicesMARSSTAIDL$STA), p=0.5, alternative = "two.sided", conf.level=0.95) #Subsistence-oriented test for STF - SIGNIFICANTLY DECREASING binom.test((str_count(practicesMARSSTFIDL[,41],"I")),length(practicesMARSSTFIDL$STF), p=0.5, alternative = "two.sided", conf.level=0.95) ########### ########### Total number of fire practices by economic/ livelihood orientation ########### for(i in c('M', 'S', 'U', 'N', 'P', 'O')) { practices[i] <- grepl(i, practices$MAR) } prac.tot <- practices %>% pivot_longer(cols = c('M', 'S', 'P', 'N', 'O', 'U'), values_to = 'MAR_val', names_to = 'Orientation') %>% filter(MAR_val == TRUE) %>% mutate(TYPE = recode(TYPE, "OP" = 'Opportunistic', 'CO' = 'Control', 'US' = 'Use', 'USCO' = 'Use with control')) %>% mutate(Orientation = recode(Orientation, 'M' = 'Market', 'S' = 'Subsistence', 'N' = 'Other', 'U' = 'Unknown', 'P' = 'Other', 'O' = 'Other')) %>% group_by(.dots = c('Orientation', 'TYPE')) %>% summarise(Count = n()) ########### ########### Maps ########### ##################################### ### Orientation by status ##################################### ### 1 prac.map <- practices %>% pivot_longer(cols = c('M', 'S', 'P', 'N', 'O', 'U'), values_to = 'MAR_val', names_to = 'Orientation') %>% filter(MAR_val == TRUE) %>% mutate(TYPE = recode(TYPE, "OP" = 'Opportunistic', 'CO' = 'Control', 'US' = 'Use', 'USCO' = 'Use with control')) %>% mutate(Orientation = factor(ifelse(Orientation == 'M', 'Market', 'Subsistence or wellbeing'))) %>% pivot_longer(cols = c('STP', 'STA', 'STF'), names_to = 'Source', values_to = 'Status') %>% mutate(Status = factor(ifelse(Status == 'L', 'Lost', 'Active'))) %>% mutate(LATITUDE = as.numeric(as.character(LATITUDE)), LONGITUDE = as.numeric(as.character(LONGITUDE))) ggplot(prac.map, aes(x = LONGITUDE, y = LATITUDE, colour = Status, shape = Orientation)) + geom_point(size = 2.5, position='jitter') + theme_classic() + borders(alpha = 0.25) + scale_colour_viridis_d() + scale_shape_manual(values = c(16, 25)) ### 2 prac.map <- practices %>% pivot_longer(cols = c('M', 'S', 'P', 'N', 'U'), values_to = 'MAR_val', names_to = 'Orientation') %>% filter(MAR_val == TRUE) %>% mutate(TYPE = recode(TYPE, "OP" = 'Opportunistic', 'CO' = 'Control', 'US' = 'Use', 'USCO' = 'Use with control')) %>% mutate(Orientation = recode(Orientation, 'M' = 'Market', 'S' = 'Subsistence', 'P' = 'Market', 'N' = 'Unknown', 'U' = 'Unknown')) %>% pivot_longer(cols = c('STP', 'STA', 'STF'), names_to = 'Source', values_to = 'Status') %>% mutate(Status = factor(ifelse(Status %in% c('L', 'D'), 'Decreasing', ifelse(Status == 'I', 'Increasing', 'Stable or Unknown')))) %>% mutate(LATITUDE = as.numeric(as.character(LATITUDE)), LONGITUDE = as.numeric(as.character(LONGITUDE))) prac.map %>% filter(Orientation != 'Unknown' & Status %in% c('Decreasing', 'Increasing')) %>% ggplot(aes(x = LONGITUDE, y = LATITUDE, shape = Status, colour = Orientation)) + borders(alpha = 0.1, size = 0.00001) + geom_point(size = 1, position='jitter') + theme_classic() + scale_colour_viridis_d() + scale_shape_manual(values = c(25, 3)) + theme_void() ### 3 - bars for(i in c('A', 'P', 'HF', 'G', 'C', 'M', 'HW', 'SS')) { prac.map[i] <- grepl(i, prac.map$FUPU1) } prac.bars <- prac.map %>% pivot_longer(cols = c('A', 'P', 'HF', 'G', 'C', 'M', 'HW', 'SS'), values_to = 'Practice', names_to = 'Practice type') %>% filter(Practice == TRUE) %>% mutate(`Practice type` = recode(`Practice type`, 'A' = 'Agriculture', 'P' = 'Pastoralism', 'HF' = 'Hunting & fishing', 'G' = 'Gathering', 'C' = 'Charcoal', 'M' = 'Movement', 'HW' = 'Human wellbeing', 'SS' = 'Social signals')) %>% filter(Orientation != 'Unknown' & Status %in% c('Decreasing', 'Increasing')) %>% group_by_at(.vars = c('Status', 'Orientation', 'Practice type')) %>% summarise('Count' = n()) ggplot(prac.bars, aes(x = `Practice type`, y = Count, fill = Status)) + geom_col(colour = 'black', position = position_dodge()) + scale_fill_viridis_d() + theme_classic() + facet_grid(Orientation ~. ) + theme(axis.text.x = element_text(angle = 60, hjust=1)) ##################################### ### Summary of data by practice status ##################################### prac.map <- practices %>% pivot_longer(cols = c('STP', 'STA', 'STF'), names_to = 'Source', values_to = 'Status') %>% mutate(Status = factor(ifelse(Status %in% c('L'), 'Lost', 'Active'))) %>% mutate(LATITUDE = as.numeric(as.character(LATITUDE)), LONGITUDE = as.numeric(as.character(LONGITUDE))) prac.map %>% ggplot(aes(x = LONGITUDE, y = LATITUDE, shape = Status, colour = Status)) + geom_point(size = 1, position='jitter') + theme_classic() + borders(alpha = 0.1, size = 0.00001) + scale_colour_viridis_d()+ theme_void()