diff --git a/r_app/Rplots.pdf b/r_app/Rplots.pdf index 55ba246..a8e9edc 100644 Binary files a/r_app/Rplots.pdf and b/r_app/Rplots.pdf differ diff --git a/r_app/parameters_project.R b/r_app/parameters_project.R index e9eb2ff..6751c9b 100644 --- a/r_app/parameters_project.R +++ b/r_app/parameters_project.R @@ -52,25 +52,31 @@ harvesting_data <- read_excel(here(data_dir, "harvest.xlsx")) %>% field = as.character(field), sub_field = as.character(sub_field), year = as.numeric(year), - season_start = as.Date(season_start), - season_end = as.Date(season_end), + season_start = as.Date(season_start, format="%d/%m/%Y"), + season_end = as.Date(season_end, format="%d/%m/%Y"), age = as.numeric(age), sub_area = as.character(sub_area), tonnage_ha = as.numeric(tonnage_ha) ) %>% mutate( season_end = case_when(season_end > Sys.Date() ~ Sys.Date(), + is.na(season_end) ~ Sys.Date(), TRUE ~ season_end), age = round(as.numeric(season_end - season_start) / 7, 0) ) log_file <- here(log_dir, paste0(format(Sys.Date(), "%Y%m%d"), ".log")) + + + + # Create a logging function log_message <- function(message) { cat(message, "\n", file = log_file, append = TRUE) } + log_head <- function(list) { - log_message(paste(capture.output(str(head(AllPivots0))), collapse = "\n")) -} \ No newline at end of file + log_message(paste(capture.output(str(head(list))), collapse = "\n")) +}