Skip to content

Commit 2a1753d

Browse files
author
EmmaCartuyvels1
committed
Create new rmd for reporting
1 parent 0408ca4 commit 2a1753d

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
---
2+
title: "Standardisation"
3+
author: "Emma Cartuyvels, Ward Langeraert, Toon Van Daele"
4+
date: "`r Sys.Date()`"
5+
output:
6+
html_document:
7+
code_folding: hide
8+
toc: true
9+
toc_float: true
10+
toc_collapsed: true
11+
editor_options:
12+
chunk_output_type: console
13+
---
14+
15+
```{r setup, include = FALSE}
16+
library(knitr)
17+
opts_chunk$set(collapse = TRUE, comment = "#>")
18+
19+
library(targets)
20+
Sys.setenv(TAR_PROJECT = "standardisation")
21+
22+
library(ggplot2)
23+
library(ggpubr)
24+
library(dplyr)
25+
library(ggforce)
26+
library(crosstalk)
27+
library(DT)
28+
library(plotly)
29+
```
30+
31+
```{r consistent colors}
32+
# Create a custom color scale
33+
library(RColorBrewer)
34+
my_colors <- brewer.pal(5, "Dark2")
35+
names(my_colors) <- c("Very rare", "Rare", "Common",
36+
"Very common", "Extremely common")
37+
col_scale <- scale_color_manual(name = "Category",
38+
values = my_colors)
39+
fill_scale <- scale_fill_manual(name = "Category",
40+
values = my_colors)
41+
```
42+
43+
## Trend comparison {.tabset}
44+
45+
### No filter
46+
```{r}
47+
selected_species <- c("Spinus spinus", "Dendrocoptes medius",
48+
"Pyrrhula pyrrhula")
49+
50+
tar_read(trend_comp_0) |>
51+
mutate(selected_species = ifelse(species %in% selected_species,
52+
"yes", "no")) |>
53+
filter(id_spat_res == "1km",
54+
time_period == "cyclus") |>
55+
ggplot(aes(x = correlation, fill = category)) +
56+
geom_histogram() +
57+
xlim(-1, 1) +
58+
fill_scale +
59+
labs(x = "Correlation",
60+
y = "Number of species")
61+
```
62+
63+
64+
### Standardized for total observations per cycle
65+
```{r}
66+
tar_read(trend_comp_3) |>
67+
filter(id_spat_res == "1km",
68+
time_period == "cyclus",
69+
id_filter_per == "cyclus") |>
70+
ggplot(aes(x = correlation, fill = category)) +
71+
geom_histogram() +
72+
xlim(-1, 1) +
73+
fill_scale +
74+
labs(x = "Correlation",
75+
y = "Number of species")
76+
77+
```
78+
79+
### Standardized for order
80+
```{r}
81+
tar_read(trend_comp_order) |>
82+
filter(id_spat_res == "1km",
83+
time_period == "cyclus") |>
84+
ggplot(aes(x = correlation, fill = category)) +
85+
geom_histogram() +
86+
xlim(-1, 1) +
87+
fill_scale +
88+
labs(x = "Correlation",
89+
y = "Number of species")
90+
```
91+
92+
### Standardized for family
93+
```{r}
94+
tar_read(trend_comp_family) |>
95+
filter(id_spat_res == "1km",
96+
time_period == "cyclus") |>
97+
ggplot(aes(x = correlation, fill = category)) +
98+
geom_histogram() +
99+
xlim(-1, 1) +
100+
fill_scale +
101+
labs(x = "Correlation",
102+
y = "Number of species")
103+
```
104+
105+
### Standardized for genus
106+
```{r}
107+
tar_read(trend_comp_genus) |>
108+
filter(id_spat_res == "1km",
109+
time_period == "cyclus") |>
110+
ggplot(aes(x = correlation, fill = category)) +
111+
geom_histogram() +
112+
xlim(-1, 1) +
113+
fill_scale +
114+
labs(x = "Correlation",
115+
y = "Number of species")
116+
```
117+
118+
119+
120+
121+
122+
123+

0 commit comments

Comments
 (0)