diff --git a/R/apus.R b/R/apus.R index 1dc4562..3a23644 100644 --- a/R/apus.R +++ b/R/apus.R @@ -67,7 +67,7 @@ Apus <- R6::R6Class( #' @description #' Add a field to the apus object #' - #' @param b_id_field (character) ID or (unique) name of the field + #' @param b_id_field (integer) ID of the field #' @param b_area (number) The area of the field (ha) #' @param b_lu (character) The cultivation code for this field #' @param d_n_req (number) The required amount of Nitrogen for this field (kg N / ha / year) @@ -83,8 +83,8 @@ Apus <- R6::R6Class( addField = function(b_id_field, b_area, b_lu, d_n_req = NA, d_p_req = NA, d_k_req = NA, d_n_norm = NA, d_n_norm_man = NA, d_p_norm = NA, b_lu_yield = NA, b_lu_price = NA) { # Check arguments --------------------------------------------------------- - checkmate::assert_character(b_id_field,len = 1) - checkmate::assert_numeric(b_area,lower = 0, upper = 100) + checkmate::assert_integerish(b_id_field,len = 1) + checkmate::assert_numeric(b_area,lower = 0, upper = 50000) checkmate::assert_subset(b_lu,choices = apus::cultivations$b_lu) checkmate::assert_numeric(d_n_req,lower = 0, upper = 400) checkmate::assert_numeric(d_p_req,lower = 0, upper = 150) diff --git a/README.md b/README.md index 7c8951c..fc39c73 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ apus$addField( # Add a second field apus$addField( - b_id_field = 1L, + b_id_field = 2L, b_area = 5000, b_lu = 'nl_262', d_n_req = 270, diff --git a/man/Apus.Rd b/man/Apus.Rd index bf3e9c7..b49b802 100644 --- a/man/Apus.Rd +++ b/man/Apus.Rd @@ -81,7 +81,7 @@ Add a field to the apus object \subsection{Arguments}{ \if{html}{\out{
}} \describe{ -\item{\code{b_id_field}}{(character) ID or (unique) name of the field} +\item{\code{b_id_field}}{(integer) ID of the field} \item{\code{b_area}}{(number) The area of the field (ha)} diff --git a/tests/testthat/test-003-apus.R b/tests/testthat/test-003-apus.R index d95e7be..cb59da2 100644 --- a/tests/testthat/test-003-apus.R +++ b/tests/testthat/test-003-apus.R @@ -96,12 +96,12 @@ test_that("Second field is added", { field3 <- data.frame( b_id_field = 3L, b_area = 5000, - b_lu = 'nl_366', + b_lu = 'nl_372', d_n_req = 370, d_p_req = 130, d_k_req = 50, d_n_norm = 330, - d_n_norm_man = 300, + d_n_norm_man = 200, d_p_norm = 80 )