This section of code reduces the number of columns in the 2016 CMD and USFS Disease Data surveyed area created in Arcmap. In order to accomplish this, the following steps are taken:
pacman::p_load(pacman, caret, lars, tidyverse, rio)
CMD_2016_Clip_SA_join<-import("C:/Users/Swenson/Documents/R/Denise/GIS/Tables/CDM_2016_Proj_Clip_SA_Join_Table2.txt")
CMD_2016_Clip_SA_join<-CMD_2016_Clip_SA_join[,c(3,4,6:98,100,101,107:111,116,117)]
write.csv(CMD_2016_Clip_SA_join,"C:/Users/Swenson/Documents/R/Denise/GIS/Reduced_Join_Tables/CMD_2016 _Proj_Clip_SA_Join_Table_Reduced.csv")
This section of code reduces the number of columns in the 2016 CMD and USFS Disease Data damage area created in Arcmap. In order to accomplish this, the following steps are taken:
CMD_2016_Clip_DA_join<-import("C:/Users/Swenson/Documents/R/Denise/GIS/Tables/CDM_2016_Proj_Clip_DA_Join_Table2.txt")
CMD_2016_Clip_DA_join<-CMD_2016_Clip_DA_join[,c(3,4,6:98,104:117,119,120,125,127:135,138,139)]
write.csv(CMD_2016_Clip_DA_join,"C:/Users/Swenson/Documents/R/Denise/GIS/Reduced_Join_Tables/CMD_2016 _Proj_Clip_DA_Join_Table_Reduced.csv")
This section of code creates the same type of csv file created in Section 1 for 2017 and 2018. The CMD_SA files contine one less column than the files in Section 1 because there was one FIA tree species in 2016 that was not recorded in 2017 or 2018.
years_17_18<-c("2017","2018")
for(i in 1:length(years_17_18)){
CMD_SA<-import(paste("C:/Users/Swenson/Documents/R/Denise/GIS/Tables/CDM_",years_17_18[i],"_Proj_Clip_SA_Join_Table2.txt",sep=""))
CMD_SA<-CMD_SA[,c(3,4,6:97,99,100,106:110,115,116)]
setwd("C:/Users/Swenson/Documents/R/Denise/GIS/Reduced_Join_Tables")
write.csv(CMD_SA,paste("CMD_",years_17_18[i],"_Proj_Clip_SA_Join_Table_Reduced.csv"))
}
This section of code creates the same type of csv file created in Section 2 for 2017 and 2018. The CMD_DA files contine one less column than the file in Section 2 because there was one FIA tree species in 2016 that was not recorded in 2017 or 2018.
for(i in 1:length(years_17_18)){
CMD_DA<-import(paste("C:/Users/Swenson/Documents/R/Denise/GIS/Tables/CDM_",years_17_18[i],"_Proj_Clip_DA_Join_Table2.txt",sep=""))
CMD_DA<-CMD_DA[,c(3,4,6:97,103:116,118,119,124,126:134,137,138)]
setwd("C:/Users/Swenson/Documents/R/Denise/GIS/Reduced_Join_Tables")
write.csv(CMD_DA,paste("CMD_",years_17_18[i],"_Proj_Clip_DA_Join_Table_Reduced.csv"))
}
This section of code reduces the number of columns in the USFS Disease Data damaged points and USFS surveyed/damaged area created in Arcmap. In order to accomplish this, the following steps are taken:
years<-c("2016","2017","2018")
file_type<-c("SA","DA")
for(i in 1:length(years)){
for(j in 1:length(file_type)){
Dpts<-import(paste("C:/Users/Swenson/Documents/R/Denise/GIS/Tables/Dpts_",years[i],"_Clip_",file_type[j],"_Join_Table2.txt",sep=""))
Dpts<-Dpts[,c(3,4,10,12:23,26:29,31,34:35)]
setwd("C:/Users/Swenson/Documents/R/Denise/GIS/Reduced_Join_Tables")
write.csv(Dpts,paste("Dpts_",years[i],"_Clip_",file_type[j],"_Join_Table_Reduced.csv",sep=""))
}
}