-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add error message for missing strata #227
base: main
Are you sure you want to change the base?
Changes from 3 commits
88a24bd
5ec8ec0
b82e3b5
3c271ee
ee3d7ca
39ea75b
0cb88d6
97efcf3
b3523c7
c09df9b
42c7af6
0f36e94
f97218a
757676e
13be640
87625a1
3bf79b3
927911a
655985b
8302735
47dd63a
2ef8e8e
6b365c0
7cac80b
cc000f7
d3a8b8c
c22ed3c
1eb1441
58e4598
bc7fe55
98c881d
474d54c
a2fc79a
05aabc1
c73eb38
a78d82a
23c8ec2
5107025
c0bd521
3c8b8b1
cebb5be
a5f4ff6
7dc8a6c
7cb6af9
41435d6
737a1c6
7ba202b
4232c42
78af1c6
4b496de
8478415
9c9626f
28cdd72
154fb5e
a73c8db
0fa2294
6b362f6
cb9c6fd
2dcff93
f2cce72
543788f
3682fac
2d251c4
7ad67e7
d8385bb
c017571
3ae6bed
201853d
c83e0cc
266bae1
c3d18bf
2587245
c3dfcbd
6fba6a8
2e395ad
491cda6
8742288
23a8baa
5c98bd5
1a73533
ae4fc68
d99d4da
cf0070b
33dc191
c984c18
9122ae8
177d334
f953b3b
8dc73c8
15a32d8
15f2bc2
4727731
4e2b8e9
1cddf51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ | |
#' curve_params = curve, | ||
#' noise_params = noise %>% filter(Country == "Pakistan"), | ||
#' antigen_isos = c("HlyE_IgG", "HlyE_IgA"), | ||
#' #num_cores = 8 # Allow for parallel processing to decrease run time | ||
#' # num_cores = 8 # Allow for parallel processing to decrease run time | ||
#' iterlim = 5 # limit iterations for the purpose of this example | ||
#' ) | ||
#' | ||
|
@@ -101,6 +101,27 @@ | |
return(to_return) | ||
} | ||
|
||
if (!any(is.element(strata,pop_data %>% names()))) { | ||
# search strata variable from pop_data | ||
strata_var <- | ||
grep( | ||
x = pop_data %>% names(), | ||
value = TRUE, | ||
pattern = strata, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what happens here if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is in order and adds complexity to Issue #233. For example, if Addendum: |
||
ignore.case = TRUE | ||
) | ||
|
||
cli::cli_abort( | ||
class = "missing_var", | ||
message = c( | ||
"Can't find the column {.var {strata}} in {.envvar pop_data}.", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please revise this inline markup; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is well-noted. |
||
if (length(strata_var) > 0) { | ||
"i" <- "Did you mean {.var {strata_var}}." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please end questions with a question mark instead of a period. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has been implemented. |
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add a test that covers this case There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has been implemented. |
||
) | ||
) | ||
} | ||
|
||
.checkStrata(data = pop_data, strata = strata) | ||
|
||
.errorCheck( | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please always format according to the style guide (add a space after the comma in
strata,pop_data
, etc)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change has been made.