diff options
Diffstat (limited to 'inst/data_generation/drift_parameters_focus.R')
-rw-r--r-- | inst/data_generation/drift_parameters_focus.R | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/inst/data_generation/drift_parameters_focus.R b/inst/data_generation/drift_parameters_focus.R new file mode 100644 index 0000000..d685cdf --- /dev/null +++ b/inst/data_generation/drift_parameters_focus.R @@ -0,0 +1,29 @@ +library(here) +library(docxtractr) +library(dplyr) + +# The file FOCUS_SWS_APPENDIX_B.doc was downloaded +# from https://esdac.jrc.ec.europa.eu/projects/surface-water +# using URL https://esdac.jrc.ec.europa.eu/public_path/projects_data/focus/sw/docs/FOCUS_SWS_APPENDIX_B.doc +# It was then opened in Microsoft Word (Microsoft Office LTSC Professional Plus 2021) +# and saved as a .docx file in inst/extdata +docx <- read_docx(here("inst/extdata/FOCUS_SWS_APPENDIX_B.docx")) + +table_1 <- docx_extract_tbl(docx, 1) +table_2 <- docx_extract_tbl(docx, 2) + +combined <- rbind(table_1[-1, ], table_2[-1, ]) +names(combined) <- c("crop_group", "n_apps", "percentile", "A", "B", "C", "D", "hinge") +combined$crop_group = c( + rep( + c("arable", "hops", "vines, late", "vines, early", "fruit, late", "fruit, early"), + each = 8), + "aerial") + +drift_parameters_focus <- combined |> + mutate(across(2:3, as.integer)) |> + mutate(across(4:8, as.numeric)) + +save(drift_parameters_focus, + file = here("data/drift_parameters_focus.RData")) + |