library(readxl)
library(ggplot2)
canopy <- read_excel("Field data single park transects.xlsx", sheet = "Canopy cover")
With grass transects
ggplot(canopy, aes(x = Site_type, y = canopy_cover)) +
geom_boxplot() +
labs(x = "Site Type", y = "% Canopy Cover") +
theme_minimal()
**Aggregated park sites for canopy cover* *
canopyagg <- read_excel("Field data single park transects.xlsx", sheet = "Canopy agg")
ggplot(canopyagg, aes(x = Site_type, y = canopy_cover)) +
geom_boxplot() +
labs(x = "Site Type", y = "% Canopy Cover") +
theme_minimal()
Original
understorey <- read_excel("Field data single park transects.xlsx", sheet = "Understorey density")
ggplot(understorey, aes(x = Site_type, y = Understorey_density)) +
geom_boxplot() +
labs(x = "Site Type", y = "Understorey density (0-5)") +
theme_minimal()
Aggregated understorey density
under.agg <- read_excel("Field data single park transects.xlsx", sheet = "Under agg")
ggplot(under.agg, aes(x = Site_type, y = Understorey_density)) +
geom_boxplot() +
labs(x = "Site Type", y = "Understorey density (0-5)") +
theme_minimal()
Original
shrub <- read_excel("Field data single park transects.xlsx", sheet = "Shrub density")
ggplot(shrub, aes(x = Site_type, y = Shrub_density)) +
geom_boxplot() +
labs(x = "Site Type", y = "Shrub density (0-5)") +
theme_minimal()
Aggregated shrub density
shrub.agg <- read_excel("Field data single park transects.xlsx", sheet = "Shrub agg")
ggplot(shrub.agg, aes(x = Site_type, y = Shrub_density)) +
geom_boxplot() +
labs(x = "Site Type", y = "Shrub density (0-5)") +
theme_minimal()
Aggregated
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(tidyr)
library(ggplot2)
ground <- read_excel("Field data single park transects.xlsx", sheet = "Ground agg")
# Reshape data to long format
ground_agg_long <- ground %>%
pivot_longer(cols = c(`Vegetation`, `Leaf litter`, `Bare soil`),
names_to = "Ground_Cover_Type",
values_to = "Percentage")
ggplot(ground_agg_long, aes(x = Site_type, y = Percentage, fill = Ground_Cover_Type)) +
geom_boxplot(position = position_dodge(width = 0.75)) +
labs(x = "Site type", y = "Ground cover (%)", title = "Ground Cover Types by Site Type") +
theme_minimal()
Strata aggregated with maximum values
strata_max <- read_excel("Field data single park transects.xlsx", sheet = "Strata agg max")
# Reshape data to long format
strata_max_long <- strata_max %>%
pivot_longer(cols = c(`Canopy`, `Understorey`, `Shrub`, `Ground`),
names_to = "Strata_heights",
values_to = "Centimetres")
ggplot(strata_max_long, aes(x = Site_type, y = Centimetres, fill = Strata_heights)) +
geom_boxplot(position = position_dodge(width = 0.75)) +
labs(x = "Site type", y = "Strata height (cm)", title = "Strata heights (max) by site type") +
theme_minimal()
Strata aggregated with averages
strata_avg <- read_excel("Field data single park transects.xlsx", sheet = "Strata agg avg")
# Reshape data to long format
strata_avg_long <- strata_avg %>%
pivot_longer(cols = c(`Canopy`, `Understorey`, `Shrub`, `Ground`),
names_to = "Strata_heights",
values_to = "Centimetres")
ggplot(strata_avg_long, aes(x = Site_type, y = Centimetres, fill = Strata_heights)) +
geom_boxplot(position = position_dodge(width = 0.75)) +
labs(x = "Site type", y = "Centimetres", title = "Strata heights (avg) by site type") +
theme_minimal()
Aggregated
logs <- read_excel("Field data single park transects.xlsx", sheet = "Logs")
ggplot(logs, aes(x = Site_type, y = Log_count)) +
geom_boxplot() +
labs(x = "Site type", y = "Number of logs") +
theme_minimal()
## Hollows
hollows <- read_excel("Field data single park transects.xlsx", sheet = "Hollows")
ggplot(hollows, aes(x = Site_type, y = Hollow_count)) +
geom_boxplot() +
labs(x = "Site type", y = "Number of hollows") +
theme_minimal()
Species richness
overall <- read_excel("Spp per site and strata.xlsx", sheet = "Sprich")
overall_sprich <- overall %>%
group_by(Site, Site_type) %>%
summarise(richness = n_distinct(`Species`))
## `summarise()` has grouped output by 'Site'. You can override using the
## `.groups` argument.
ggplot(overall_sprich, aes(x = Site_type, y = richness)) +
geom_boxplot() +
labs(x = "Site type", y = "Species richness") +
theme_minimal()
Species abundance
ggplot(overall, aes(x = Site_type, y = Abundance)) +
geom_boxplot() +
labs(x = "Site type", y = "Species abundance") +
theme_minimal()
Richness per strata
strata_sprich <- overall %>%
group_by(Strata, Site, Site_type) %>%
summarise(richness = n_distinct(`Species`))
## `summarise()` has grouped output by 'Strata', 'Site'. You can override using
## the `.groups` argument.
ggplot(strata_sprich, aes(x = Site_type, y = richness, fill = Strata)) +
geom_boxplot(position = position_dodge(width = 0.75)) +
labs(x = "Site type", y = "Richness", title = "Richness per strata") +
theme_minimal()
Abundance per strata
ggplot(overall, aes(x = Site_type, y = Abundance, fill = Strata)) +
geom_boxplot(position = position_dodge(width = 0.75)) +
labs(x = "Site type", y = "Abundance", title = "Abundance per strata") +
theme_minimal()
biostatus <- read_excel("Spp per site and strata.xlsx", sheet = "Sprich")
biostatus$Biostatus <- as.factor(biostatus$Biostatus)
ggplot(biostatus, aes(x = Site_type, y = Abundance, fill = Biostatus)) +
geom_boxplot(position = position_dodge(width = 0.75)) +
labs(x = "Site type", y = "Richness", title = "Abundance per biostatus") +
theme_minimal()
ggplot(biostatus, aes(x = Site_type, y = Abundance, fill = Biostatus)) +
geom_bar(stat = "identity", position = "dodge")
facet_wrap(~ Biostatus)
## <ggproto object: Class FacetWrap, Facet, gg>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map_data: function
## params: list
## setup_data: function
## setup_params: function
## shrink: TRUE
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetWrap, Facet, gg>
labs(x = "Site Type", y = "Abundance", fill = "Biostatus") +
theme_minimal()
## NULL
Richness per biostatus
bio_sprich <- biostatus %>%
group_by(Site, Site_type, Biostatus) %>%
summarise(richness = n_distinct(`Species`))
## `summarise()` has grouped output by 'Site', 'Site_type'. You can override using
## the `.groups` argument.
# Remove entries with NA as the biostatus
bio_sprich_filtered <- bio_sprich %>%
filter(!is.na(Biostatus))
ggplot(bio_sprich_filtered, aes(x = Site_type, y = richness, fill = Biostatus)) +
geom_boxplot(position = position_dodge(width = 0.75)) +
labs(x = "Site type", y = "Richness", title = "Richness by biostatus") +
theme_minimal()
DBH
DBH <- read_excel("Field data single park transects.xlsx", sheet = "Tree DBH")
ggplot(DBH, aes(x = Site_type, y = DBH)) +
geom_boxplot() +
labs(x = "Site type", y = "DBH") +
theme_minimal()
Tree abundance by site type
library(dplyr)
trees <- read_excel("Field data single park transects.xlsx", sheet = "Tree agg")
tree_abund <- trees %>%
group_by(Site, Site_type) %>%
summarise(abundance = n())
## `summarise()` has grouped output by 'Site'. You can override using the
## `.groups` argument.
ggplot(tree_abund, aes(x = Site_type, y = abundance)) +
geom_boxplot() +
labs(x = "Site Type", y = "Tree abundance") +
theme_minimal()
Tree richness by site type
tree_sprich <- trees %>%
group_by(Site, Site_type) %>%
summarise(richness = n_distinct(`Spp ID`))
## `summarise()` has grouped output by 'Site'. You can override using the
## `.groups` argument.
ggplot(tree_sprich, aes(x = Site_type, y = richness)) +
geom_boxplot() +
labs(x = "Site type", y = "Species richness") +
theme_minimal()
Sapling abundance by site type
sapling <- read_excel("Field data single park transects.xlsx", sheet = "Saplings agg")
ggplot(sapling, aes(x = Site_type, y = Abundance)) +
geom_boxplot() +
labs(x = "Site Type", y = "Sapling abundance") +
theme_minimal()
sapling_sprich <- sapling %>%
group_by(Site, Site_type) %>%
summarise(richness = n_distinct(`Species`))
## `summarise()` has grouped output by 'Site'. You can override using the
## `.groups` argument.
ggplot(sapling_sprich, aes(x = Site_type, y = richness)) +
geom_boxplot() +
labs(x = "Site type", y = "Species richness") +
theme_minimal()
shrub <- read_excel("Field data single park transects.xlsx", sheet = "Shrub spp agg")
ggplot(shrub, aes(x = Site_type, y = Abundance)) +
geom_boxplot() +
labs(x = "Site Type", y = "Sapling abundance") +
theme_minimal()
shrub_sprich <- shrub %>%
group_by(Site, Site_type) %>%
summarise(richness = n_distinct(`Spp ID`))
## `summarise()` has grouped output by 'Site'. You can override using the
## `.groups` argument.
ggplot(shrub_sprich, aes(x = Site_type, y = richness)) +
geom_boxplot() +
labs(x = "Site type", y = "Species richness") +
theme_minimal()
## Shrub spp diversity
floor <- read_excel("Field data single park transects.xlsx", sheet = "Floor spp agg")
ggplot(floor, aes(x = Site_type, y = Abundance)) +
geom_boxplot() +
labs(x = "Site Type", y = "Floor species abundance") +
theme_minimal()
floor_sprich <- floor %>%
group_by(Site, Site_type) %>%
summarise(richness = n_distinct(`Spp ID`))
## `summarise()` has grouped output by 'Site'. You can override using the
## `.groups` argument.
ggplot(floor_sprich, aes(x = Site_type, y = richness)) +
geom_boxplot() +
labs(x = "Site type", y = "Species richness") +
theme_minimal()
## Diversity
other <- read_excel("Field data single park transects.xlsx", sheet = "Other spp agg")
ggplot(other, aes(x = Site_type, y = Abundance)) +
geom_boxplot() +
labs(x = "Site Type", y = "Species abundance") +
theme_minimal()
other_sprich <- other %>%
group_by(Site, Site_type) %>%
summarise(richness = n_distinct(`Spp ID`))
## `summarise()` has grouped output by 'Site'. You can override using the
## `.groups` argument.
ggplot(other_sprich, aes(x = Site_type, y = richness)) +
geom_boxplot() +
labs(x = "Site type", y = "Species richness") +
theme_minimal()
# Floral resources
floral <- read_excel("Field data single park transects.xlsx", sheet = "Floral agg")
ggplot(floral, aes(x = Site_type, y = No_floral_units)) +
geom_boxplot() +
labs(x = "Site Type", y = "Species abundance") +
theme_minimal()
ggplot(floral, aes(x = Site_type, y = No_flowers)) +
geom_boxplot() +
labs(x = "Site Type", y = "Species abundance") +
theme_minimal()