Closed cynthiahqy closed 1 year ago
Can get a bit convoluted though e.g. for abort_weights_col_type
is_df_col_type <- function(df, col_name,
col_type = c("numeric")){
switch(col_type,
numeric = is.numeric(df[[col_name]]))
}
abort_df_col_type <- function(col_name, col_type){
cli::cli_abort(
message = "The column `{col_name}` should be of type {col_type}",
class = "abort_col_type"
)
}
Use format_message() instead as shown in https://github.com/cynthiahqy/conformr-xmap-project/pull/121/commits/14c0914d4133231473883df2ddd45bd6d443c728
abort_<condition>
functions should have a single purpose -- to return an error message, and the calculation of the boolean flag should be separate i.e.