knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE, error = FALSE, cache = TRUE)
# For data wrangling
library(tidyverse)
# To get model parameters
library(kableExtra)
library(ggtern)
if (params$Comparison == "Habitat"){
Paragraph1 <- paste("A comparison was made using", base::tolower(params$Comparison), "as basis with", params$Habitat, "as point of comparison.") 
} else if (params$Comparison == "Distance"){
  Paragraph1 <- paste("A comparison was made using", base::tolower(params$Comparison), "as basis with", prettyNum(params$Distance, big.mark = ","), "meters to select nearby point for comparison.")
}

This is a report generated for group r params$Group. r Paragraph1 The selected plot is r params$Plot. This generated a comparison with r prettyNum(nrow(params$Data), big.mark = ",") plots.

In figure \@ref(fig:EllembergBoxplot) we can see how the selected site compares in ellemberg values to the selected plots from NOVANA.

Data <- params$Data %>% mutate(N_R = N/R) %>%
             as.data.frame() %>%
             dplyr::select(-geometry, -Species, - Richness) %>%
             pivot_longer(cols = c("L", "F", "R", "N", "N_R"), names_to = "Ellemberg") %>%
             mutate(Ellemberg = gsub(pattern = "N_R", replacement = "N/R", x = Ellemberg))

         ggplot(Data, aes(x = "Plots", y = value)) +
             geom_boxplot() +
             geom_jitter(aes(color = Data)) +
             labs(x = NULL,
                  y = "Ellemberg value") +
             theme_bw() +
             theme(axis.title.y=element_blank(),
                   axis.text.y=element_blank(),
                   axis.ticks.y=element_blank()) +
             facet_wrap(~Ellemberg, ncol = 1, strip.position = "right") +
             ggplot2::coord_flip()

In figure \@ref(fig:RichnessBoxplot) we can see how the selected site compares in diversity estimates to the selected plots from NOVANA.

Data <- params$Data %>% 
  as.data.frame() %>%
             dplyr::select(-geometry, -Species) %>%
             pivot_longer(cols = c("Richness", "Artsindex"), names_to = "Diversity")

         G <- ggplot(Data, aes(x = "Plots", y = value)) +
             geom_boxplot() +
             geom_jitter(aes(color = Data), alpha = 0.5) +
             labs(x = NULL,
                  y = "Diversity estimate") +
             theme_bw() +
             facet_wrap(~Diversity, ncol = 1, scales = "free", strip.position = "right") +
             theme(axis.title.y=element_blank(), axis.text.y=element_blank(),
                   axis.ticks.y=element_blank())  +
             ggplot2::coord_flip()

print(G)

In figure \@ref(fig:GGTERN) we can see how the selected site compares in median Grimes values to the selected plots from NOVANA.

Data <- params$Data %>%
             as.data.frame() %>%
             dplyr::select(-geometry) %>%
             arrange(desc(Data)) %>%
             mutate(Data = fct_relevel(Data, "Novana", "Group"))

         print(ggtern(data = Data, aes(x = grime_R, y = grime_C, z = grime_S)) +
             geom_point(aes(color = rgb, size = Data, shape = Data), alpha = 0.5) + scale_color_identity() + ggtern::theme_rgbw() +
             zlab('Stress tolerator') + xlab('Ruderal') + ylab('Competitor'))


Sustainscapes/PlotExplorer documentation built on April 27, 2022, 1:53 p.m.