Skip to content

Commit

Permalink
Update coev_calculate_theta() check
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Claessens authored and Scott Claessens committed Jul 22, 2024
1 parent d262707 commit 32e7030
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions R/coev_calculate_theta.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,13 @@ coev_calculate_theta <- function(object, intervention_values) {
stop2("Argument 'intervention_values' contains duplicated variable names.")
}
# stop if any values in intervention_list are not of length one
# or if any values are not NA and not numeric
if (any(unlist(lapply(intervention_values, length)) != 1) |
any(unlist(lapply(intervention_values,
function(x) !is.na(x) & !is.numeric(x))))
) {
stop2(
paste0(
"Values in 'intervention_values' must either be NA or a ",
"numeric value of length one."
)
)
if (any(unlist(lapply(intervention_values, length)) != 1)) {
stop2("Values in 'intervention_values' must each be of length one.")
}
# stop if any values in intervention_list are not NA or numeric
if (any(unlist(lapply(intervention_values,
function(x) !is.na(x) & !is.numeric(x))))) {
stop2("Values in 'intervention_values' must each be NA or numeric.")
}
# stop if all variables are held constant in intervention_list
if (mean(is.na(intervention_values)) == 0) {
Expand Down

0 comments on commit 32e7030

Please sign in to comment.