From 7bf5aad5e3b89c157d1b31a586ee87a25386117d Mon Sep 17 00:00:00 2001 From: Ranke Johannes Date: Wed, 31 Jan 2024 17:59:04 +0100 Subject: Drift curve parameters from FOCUS SW Appendix B --- inst/data_generation/drift_parameters_Rautmann.R | 5 ---- inst/data_generation/drift_parameters_focus.R | 29 +++++++++++++++++++++++ inst/extdata/FOCUS_SWS_APPENDIX_B.docx | Bin 0 -> 40128 bytes 3 files changed, 29 insertions(+), 5 deletions(-) delete mode 100644 inst/data_generation/drift_parameters_Rautmann.R create mode 100644 inst/data_generation/drift_parameters_focus.R create mode 100644 inst/extdata/FOCUS_SWS_APPENDIX_B.docx (limited to 'inst') diff --git a/inst/data_generation/drift_parameters_Rautmann.R b/inst/data_generation/drift_parameters_Rautmann.R deleted file mode 100644 index 2dea272..0000000 --- a/inst/data_generation/drift_parameters_Rautmann.R +++ /dev/null @@ -1,5 +0,0 @@ -library(here) - -save(drift_parameters_Rautmann, - file = "../data/drift_parameters_Rautmann.RData") - 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")) + diff --git a/inst/extdata/FOCUS_SWS_APPENDIX_B.docx b/inst/extdata/FOCUS_SWS_APPENDIX_B.docx new file mode 100644 index 0000000..13d735e Binary files /dev/null and b/inst/extdata/FOCUS_SWS_APPENDIX_B.docx differ -- cgit v1.2.1