library(RSFIA) library(ClelandEcoregions) mort_df <- FIA_mortality_with_explanatory
message('Statistics for written results:') cat('\nOverall mean mortality:', mean(mort_df$mort_rate)) ForestSummary(ftype_min = 2) message('Plotting Figure 1 (a + b)') PlotFullMortMap() od2 <- 'C:/Users/Brandon/Documents/docs/PHD/chapter_1/draft 16' pw1 <- CalcSectionWilcox(x = 'province') print(pw1) pw2 <- CalcPairwiseWilcox('section', 'mort_rate', out_dir = od2, write = T) # Just reference the section table as a Table # Supplemental Table S1/S2: # TODO: combine these tables into one big table message('Supplemental Table S1:') tbl1 <- MakePlotCountTable(by = 'section', csv = F) print(tbl1) mean(tbl1$`All Mort, Background`) message('Supplemental Table S2:') tbl2 <- MakePlotCountTable(by = 'forest_type', csv = F) print(tbl2)
# Statistics for written results: mort_by_province <- aggregate(mort_df$mort_rate, by = list(mort_df$Cleland_province), FUN = mean) mort_by_province[, 1] <- KeyClelandCode(mort_by_province[, 1]) mort_by_province[, 2] <- round(mort_by_province[, 2] * 100, 2) colnames(mort_by_province) <- c('Province', 'Mean 10-Year Mortality') cat('\nOverall mean mort:', round(mean(mort_df$mort_rate) * 100, 2), '%\n\n') message('Mean mortality by province, Supplemental Table S3:') print(mort_by_province) #write.csv(mort_by_province, 'supplemental_table_s3.csv')
message('Figure 2:') PlotOutlierMortBoxplot() message('Table for significance:') AnalyzeMortByIQR() # Some stats for the Figure 2 results: print(outlier_count_table) # this table was built by hand, should probably make it into a function
AgentSummary() PlotPercentAgent() ComorbidAgentTable(only_multiple = F, only_mort = F) ComorbidAgentTable(only_multiple = F, only_mort = T) ComorbidAgentTable(only_multiple = T, only_mort = F) message('Figures 3/4/5:') PlotPolarBar(type = 'plots', drop_no_mort = T, split = T, clear_plots = T) PlotStackedBarChart( by = 'section', clear_plots = T, split = T, excl_dom_ftype = T, drop_no_mort = T ) #PlotPolarBar(type = 'trees', drop_no_mort = T, split = T, clear_plots = T) # The tree plot is almost the same plot as the plots plot. # Update AgentTypeDiffTest() for a statistical test between them # When split = F, the difference between the plot and tree plots are that # more trees overall are killed by harvest/fire, and the fraction of # Other/Vegetation/Weather goes down. #PlotPolarWithMultipleMort() # use corplot??? corrplot::cor
message('Figures 6/7:') PlotStackedUncommForType() PlotOutlierForestBoxplot()
message('Figures 8/9:') PlotStackedDomForType() PlotDomForBoxplot()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.