@@ -11,7 +11,7 @@ check_string_param <- function(name, value, required = TRUE) {
11
11
}
12
12
13
13
check_int_param <- function (name , value , required = TRUE ) {
14
- # string or string []
14
+ # numeric or numeric []
15
15
if ((required &&
16
16
! (! is.null(value ) &&
17
17
is.numeric(value ))) ||
@@ -23,24 +23,24 @@ check_int_param <- function(name, value, required = TRUE) {
23
23
}
24
24
25
25
is_epirange_like <- function (value ) {
26
+ # character or numeric or EpiRange or list(from=..., to=...)
26
27
is.character(value ) ||
27
28
is.numeric(value ) ||
28
29
inherits(value , " EpiRange" ) ||
29
30
(is.list(value ) &&
30
31
" from" %in% names(value ) && " to" %in% names(value ))
31
32
}
32
33
33
- check_single_epirange_param <-
34
- function (name , value , required = TRUE ) {
35
- if ((required &&
36
- ! (! is.null(value ) &&
37
- is_epirange_like(value ))) ||
38
- (! required && ! (is.null(value ) || is_epirange_like(value )))) {
39
- rlang :: abort(paste0(" argument " , name , " is not a epirange" ),
40
- name = name , value = value , class = " invalid_argument"
41
- )
42
- }
34
+ check_single_epirange_param <- function (name , value , required = TRUE ) {
35
+ if ((required &&
36
+ ! (! is.null(value ) &&
37
+ is_epirange_like(value ))) ||
38
+ (! required && ! (is.null(value ) || is_epirange_like(value )))) {
39
+ rlang :: abort(paste0(" argument " , name , " is not a epirange" ),
40
+ name = name , value = value , class = " invalid_argument"
41
+ )
43
42
}
43
+ }
44
44
45
45
check_epirange_param <- function (name , value , required = TRUE ) {
46
46
if (is.null(value )) {
0 commit comments