Closed mb706 closed 4 months ago
Hi @mb706, thanks for the observations!
Regarding your points:
NULL
values. Would you fix this with a wrapper like the following or are you aware of a better method?null_to_char <- function(x) {
if (is.null(x)) {
cat("NULL")
} else {
cat(x)
}
}
If the value is only ever a scalar or NULL
you can also do cat(x %??% "NULL")
, using %??%
from checkmate.
I don't think you need a helper function here, but if you want to implement one, I would not write a function that outputs a value (using cat), but instead just converts to a string, e.g. to_string <- function(x) x %??% "NULL"
. It could also do other things, like paste(x, collapse = ", ")
, if it should be necessary somewhere.
Following the steps from the intro vignette, but then printing the
"CounterfactualMethod"
object:gives the output
-upper: - weights:
looks unintentionallower
andupper
right next to each otherlower:
andmax_changed:
deliberate?