updated date format for excel
This commit is contained in:
parent
f08da04c3b
commit
ddb4fdbc02
BIN
r_app/Rplots.pdf
BIN
r_app/Rplots.pdf
Binary file not shown.
|
|
@ -52,25 +52,31 @@ harvesting_data <- read_excel(here(data_dir, "harvest.xlsx")) %>%
|
||||||
field = as.character(field),
|
field = as.character(field),
|
||||||
sub_field = as.character(sub_field),
|
sub_field = as.character(sub_field),
|
||||||
year = as.numeric(year),
|
year = as.numeric(year),
|
||||||
season_start = as.Date(season_start),
|
season_start = as.Date(season_start, format="%d/%m/%Y"),
|
||||||
season_end = as.Date(season_end),
|
season_end = as.Date(season_end, format="%d/%m/%Y"),
|
||||||
age = as.numeric(age),
|
age = as.numeric(age),
|
||||||
sub_area = as.character(sub_area),
|
sub_area = as.character(sub_area),
|
||||||
tonnage_ha = as.numeric(tonnage_ha)
|
tonnage_ha = as.numeric(tonnage_ha)
|
||||||
) %>%
|
) %>%
|
||||||
mutate(
|
mutate(
|
||||||
season_end = case_when(season_end > Sys.Date() ~ Sys.Date(),
|
season_end = case_when(season_end > Sys.Date() ~ Sys.Date(),
|
||||||
|
is.na(season_end) ~ Sys.Date(),
|
||||||
TRUE ~ season_end),
|
TRUE ~ season_end),
|
||||||
age = round(as.numeric(season_end - season_start) / 7, 0)
|
age = round(as.numeric(season_end - season_start) / 7, 0)
|
||||||
)
|
)
|
||||||
|
|
||||||
log_file <- here(log_dir, paste0(format(Sys.Date(), "%Y%m%d"), ".log"))
|
log_file <- here(log_dir, paste0(format(Sys.Date(), "%Y%m%d"), ".log"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Create a logging function
|
# Create a logging function
|
||||||
log_message <- function(message) {
|
log_message <- function(message) {
|
||||||
cat(message, "\n", file = log_file, append = TRUE)
|
cat(message, "\n", file = log_file, append = TRUE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
log_head <- function(list) {
|
log_head <- function(list) {
|
||||||
log_message(paste(capture.output(str(head(AllPivots0))), collapse = "\n"))
|
log_message(paste(capture.output(str(head(list))), collapse = "\n"))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue