Skip to content

Commit

Permalink
Merge pull request #13 from PetterHopp/main
Browse files Browse the repository at this point in the history
OKplan v0.7.0
  • Loading branch information
PetterHopp authored Jan 5, 2024
2 parents eb95fbb + 0c5a5be commit 8d43466
Show file tree
Hide file tree
Showing 24 changed files with 879 additions and 107 deletions.
38 changes: 25 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,52 +29,62 @@ data reporting at the Norwegian Veterinary Institute (NVI).
<tr class="odd">
<td style="text-align: left;">NVIconfig</td>
<td style="text-align: left;">Private</td>
<td style="text-align: left;">Configuration information necessary for some NVIverse functions</td>
<td style="text-align: left;">Configuration information necessary for
some NVIverse functions</td>
</tr>
<tr class="even">
<td style="text-align: left;">NVIdb</td>
<td style="text-align: left;">Public</td>
<td style="text-align: left;">Tools to facilitate the use of NVI’s databases</td>
<td style="text-align: left;">Tools to facilitate the use of NVI’s
databases</td>
</tr>
<tr class="odd">
<td style="text-align: left;">NVIspatial</td>
<td style="text-align: left;">Public</td>
<td style="text-align: left;">Tools to facilitate working with spatial data at NVI</td>
<td style="text-align: left;">Tools to facilitate working with spatial
data at NVI</td>
</tr>
<tr class="even">
<td style="text-align: left;">NVIpretty</td>
<td style="text-align: left;">Public</td>
<td style="text-align: left;">Tools to make R-output pretty in accord with NVI’s graphical profile</td>
<td style="text-align: left;">Tools to make R-output pretty in accord
with NVI’s graphical profile</td>
</tr>
<tr class="odd">
<td style="text-align: left;">NVIbatch</td>
<td style="text-align: left;">Public</td>
<td style="text-align: left;">Tools to facilitate the running of R-scripts in batch mode at NVI</td>
<td style="text-align: left;">Tools to facilitate the running of
R-scripts in batch mode at NVI</td>
</tr>
<tr class="even">
<td style="text-align: left;">OKplan</td>
<td style="text-align: left;">Public</td>
<td style="text-align: left;">Tools to facilitate the planning of surveillance programmes for the NFSA</td>
<td style="text-align: left;">Tools to facilitate the planning of
surveillance programmes for the NFSA</td>
</tr>
<tr class="odd">
<td style="text-align: left;">OKcheck</td>
<td style="text-align: left;">Public</td>
<td style="text-align: left;">Tools to facilitate checking of data from national surveillance programmes</td>
<td style="text-align: left;">Tools to facilitate checking of data from
national surveillance programmes</td>
</tr>
<tr class="even">
<td style="text-align: left;">NVIcheckmate</td>
<td style="text-align: left;">Public</td>
<td style="text-align: left;">Extension of checkmate with argument checking adapted for NVIverse</td>
<td style="text-align: left;">Extension of checkmate with argument
checking adapted for NVIverse</td>
</tr>
<tr class="odd">
<td style="text-align: left;">NVIpackager</td>
<td style="text-align: left;">Public</td>
<td style="text-align: left;">Tools to facilitate the development of NVIverse packages</td>
<td style="text-align: left;">Tools to facilitate the development of
NVIverse packages</td>
</tr>
<tr class="even">
<td style="text-align: left;">NVIrpackages</td>
<td style="text-align: left;">Public</td>
<td style="text-align: left;">Keeps a table of the R-Packages in NVIverse</td>
<td style="text-align: left;">Keeps a table of the R packages in
NVIverse</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -147,9 +157,11 @@ development guidelines below.

## Development guidelines

If you want to contribute code, you are welcome to do so. Please try to
adhere to some principles and style convention used for
`NVIverse`-packages.
If you want to contribute code, you are welcome to do so. You will find
a description of the code conventions, which have been used, in the
vignette “NVIverse code conventions” in the package `NVIpackager`. A
summary of the principles and style convention used for
`NVIverse`-packages is given below.

- Please limit the number of package dependencies for `OKplan`. The
use of base functions is much appreciated.
Expand Down
16 changes: 9 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: OKplan
Title: Tools to facilitate the Planning of the annual Surveillance Programmes
Version: 0.6.1
Date: 2023-10-09
Version: 0.7.0
Date: 2024-01-05
Authors@R:
c(person(given = "Petter",
family = "Hopp",
Expand All @@ -21,26 +21,28 @@ LazyData: true
Imports:
checkmate,
dplyr,
knitr,
magrittr,
openxlsx,
rlang,
rmarkdown,
stats,
NVIbatch (>= 0.4.0),
NVIcheckmate (>= 0.6.0),
NVIcheckmate (>= 0.7.3),
NVIdb (>= 0.3.0),
NVIpretty (>= 0.4.0),
NVIrpackages,
OKcheck
Suggests:
covr,
desc,
devtools,
findInFiles,
knitr,
purrr,
rmarkdown,
testthat,
usethis,
utils,
NVIpackager
NVIpackager,
NVIrpackages
Remotes:
NorwegianVeterinaryInstitute/NVIbatch,
NorwegianVeterinaryInstitute/NVIcheckmate,
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2020 - 2023 Norwegian Veterinary Institute
Copyright (c) 2020 - 2024 Norwegian Veterinary Institute
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export(append_date_generated_line)
export(append_sum_line)
export(check_OK_selection)
export(check_ok_selection)
export(get_holiday)
export(get_tested_herds)
export(make_random)
export(style_sum_line)
Expand Down
27 changes: 25 additions & 2 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
OKplan 0.7.0 - (2024-01-05)
----------------------------------------

New features:

- Created `get_holiday` to get the "non-workdays" or "workdays" within one year.


Bug fixes:

- Fixed several bugs in `get_tested_herds`.


Other changes:

- To come.


BREAKING CHANGES:

- To come.


OKplan 0.6.1 - (2023-10-09)
----------------------------------------

Bug fixes:

- the argument `year` in `get_tested_herds` now accepts more than one year as input.
- The argument `year` in `get_tested_herds` now accepts more than one year as input.

- The argument column can now be passed to append_sum_line.
- `write_ok_selection_list` now accepts the argument `column` which will be passed to `append_sum_line`.


Other changes:
Expand Down
7 changes: 5 additions & 2 deletions R/adjust_samples_to_budget.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,13 @@ adjust_samples_to_budget <- function(data,
dplyr::mutate(total_estimated = sum(dplyr::across(dplyr::all_of(sample_to_adjust)), na.rm = TRUE)) %>%
dplyr::mutate(included = dplyr::case_when(dplyr::across(dplyr::all_of(sample_to_adjust)) > 0 ~ 1,
TRUE ~ 0)) %>%
dplyr::mutate(n_units = sum(.data$included, na.rm = TRUE)) %>%
# dplyr::mutate(n_units = sum(.data$included, na.rm = TRUE)) %>%
dplyr::mutate(n_units = sum(dplyr::across(dplyr::all_of("included")), na.rm = TRUE)) %>%
dplyr::mutate(difference = .data$total_estimated - as.numeric(.data$budget)) %>%
# dplyr::mutate(difference = as.numeric(dplyr::all_of("total_estimated")) - as.numeric(dplyr::all_of("budget"))) %>% # This don't work
dplyr::ungroup() %>%
dplyr::group_by(dplyr::across(dplyr::all_of(group)), .data$included) %>%
# dplyr::group_by(dplyr::across(dplyr::all_of(group)), .data$included) %>%
dplyr::group_by(dplyr::across(dplyr::all_of(c(group, "included")))) %>%
dplyr::mutate(n_seq = 1:dplyr::n()) %>%
dplyr::ungroup()

Expand Down
1 change: 0 additions & 1 deletion R/check_ok_selection.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,5 @@ check_ok_selection <- function(input = system.file('templates', "check_ok_select
intermediates_dir = tempdir(),
params = list("data" = data, "purpose" = purpose, "plan_aar" = plan_aar),
display = display,
email = FALSE,
...)
}
13 changes: 7 additions & 6 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#' @title Data: Column standards for OK sampling plans.
#'
#' @description A data frame with the column standards for data frames and Excel
#' sheets produced when planning of the Norwegian surveillance programmes.
#' The raw data for the column standards can be edited in the original Excel
#' table. The the code for preparing of the data frame is written in
#' "./data-raw/generate_OK_column_standards". The \code{OK_column_standards}
#' is used as input for
#' @description A data frame with the column standards for data frames
#' and Excel sheets produced when planning the sampling schemes for
#' the Norwegian surveillance programmes. The raw data for the column
#' standards can be edited in the original Excel table. The code for
#' preparing of the data frame is written in
#' "./data-raw/generate_OK_column_standards". The
#' \code{OK_column_standards} is used as input for
#' \ifelse{html}{\code{\link[NVIdb]{standardize_columns}}}{\code{NVIdb::standardize_columns}}.
#'
#' @format A data frame with 14 variables:
Expand Down
Loading

0 comments on commit 8d43466

Please sign in to comment.