So I have been trying to wrap my head around how to set a value to missing with an IF ELSE statement… It seems like this should be an easy way to do it:
df= @chain df begin
@transform :x= begin
if :x != 0
:x
else missing
end
end
end
(btw if performance matters you can probably do better by using digits of your Int to directly construct the date rather than allocating a string and then parsing that)
It seems that ifelse evaluates the datefromint function even if d == 0.
I wonder if this is the case in general, that is, if ifelse evaluates both the “then” and “else” conditions before the return?
But it is more likely that there is something (or more than something) that he did not understand.