In the package NMsim (v0.2.5), a test failure occurs because the replacement function passed to stringr::str_replace_all returns a double vector instead of a character vector. To fix this, ensure the function used as the replacement argument returns character strings.
Error context:
Error in `stringr::str_replace_all(mod$THETA, "\\d+\\.\\d+", function(x) round(as.numeric(x),
digits = 3))`: `replacement` function must return a character vector, not a double
vector.
# Incorrect usage causing error:
stringr::str_replace_all(mod$THETA, "\\d+\\.\\d+", function(x) round(as.numeric(x), digits = 3))
# Correct usage (ensure character return):
stringr::str_replace_all(mod$THETA, "\\d+\\.\\d+", function(x) as.character(round(as.numeric(x), digits = 3)))