This should be harmless for the large majority of the time when someone inputs a character vector, but should prevent issues that arise when the input is a numeric vector.
As an illustration of the issues with a numeric vector input,
compare replace_number(999999) and replace_number("999999"), which both return what you'd expect, to replace_number(1000000) and replace_number("1000000"), which give different results.
This should be harmless for the large majority of the time when someone inputs a character vector, but should prevent issues that arise when the input is a numeric vector.
As an illustration of the issues with a numeric vector input, compare
replace_number(999999)
andreplace_number("999999")
, which both return what you'd expect, toreplace_number(1000000)
andreplace_number("1000000")
, which give different results.