Skip to content

Commit

Permalink
Update CI_1_Generate_reports.R
Browse files Browse the repository at this point in the history
  • Loading branch information
markus1bauer committed Feb 17, 2024
1 parent 3b906a5 commit d5ffff3
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions R/CI_1_Generate_reports.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
library(dplyr)
library(forcats)
library(ggplot2)
library(gt)
library(here)
library(kableExtra)
library(knitr)
Expand All @@ -19,7 +20,6 @@ webshot::install_phantomjs()

### Start ###
rm(list = ls())
renv::status()



Expand Down Expand Up @@ -54,18 +54,22 @@ sites <- read_csv(
values_transform = list (n = as.character)
) %>%
pivot_wider(names_from = "x", values_from = "n") %>%
mutate(plot = str_replace(plot, "-", "_"),
plot = str_replace(plot, "L_", "L"),
plot = str_replace(plot, "W_", "W"),
id = str_c(plot, survey_year, sep = "_"),
plot = factor(plot),
id = factor(id),
vegetation_cover = as.numeric(vegetation_cover)) %>%
filter(!(site == "C" & (survey_year == "seeded" |
survey_year == "2018" |
survey_year == "2019" |
survey_year == "2020" |
survey_year == "2021")))
mutate(
plot = str_replace(plot, "-", "_"),
plot = str_replace(plot, "L_", "L"),
plot = str_replace(plot, "W_", "W"),
id = str_c(plot, survey_year, sep = "_"),
plot = factor(plot),
id = factor(id),
vegetation_cover = as.numeric(vegetation_cover)
) %>%
filter(
!(site == "C" & (survey_year == "seeded" |
survey_year == "2018" |
survey_year == "2019" |
survey_year == "2020" |
survey_year == "2021"))
)



Expand Down Expand Up @@ -151,9 +155,8 @@ values <- seq(from = 0, to = 100, by = 5)

### Check typos of sites cover ###
data <- sites %>%
filter(!str_detect(id, "_seeded$")) %>%
filter(!(vegetation_cover %in% values) &
!is.na(vegetation_cover))
#filter(!str_detect(id, "_seeded$")) %>%
filter(!(vegetation_cover %in% values) & !is.na(vegetation_cover))

file <- here("tests", "testthat", "warnings_sites_typos.png")

Expand All @@ -167,10 +170,10 @@ if(count(data) == 0) {

} else {

data #%>%
#gt() %>%
#tab_options(table.font.size = px(10)) %>%
#gtsave(file)
data %>%
gt() %>%
tab_options(table.font.size = px(10)) %>%
gtsave(file)

}

Expand Down Expand Up @@ -230,7 +233,8 @@ data <- species %>%
select(id, survey_year, vegetation_cover, value, diff) %>%
filter(!str_detect(id, "_seeded$")) %>%
filter(diff > 20 | diff < -5) %>%
arrange(survey_year, id, diff)
arrange(survey_year, id, diff) #%>%
#mutate(warning_name == "warnings_different_total_cover")

file <- here("tests", "testthat", "warnings_different_total_cover.png")

Expand Down

0 comments on commit d5ffff3

Please sign in to comment.