It seems replace function parse the "4" as "" * "4" * "" and then replace the empty string with missing string. I canβt understand why the function works in that way.
Iβm new to Julia, and Iβm used to programming in Python where everything is an object. I used to think that I could convert a string object to a missing object, so I was confused when I encountered the string βmissing4missingβ in Julia.
It is the same with Julia. Just you need to notice that replace has two signatures (quoting its docstring):
replace(A, old_new::Pair...; [count::Integer])
Return a copy of collection A where, for each pair old=>new in old_new,
all occurrences of old are replaced by new. Equality is
determined using isequal.
If count is specified, then replace at most count occurrences in total.
and
replace(s::AbstractString, pat=>r, [pat2=>r2, ...]; [count::Integer])
Search for the given pattern pat in s, and replace each occurrence with r.
If count is provided, replace at most count occurrences.
You wanted to call the first (which works on collections like a vector), but you used @rtransform which applied replace to each individual string instead of the collection as a whole (the r letter in front of transform signaled this choice).