Can someone explain to me why the following happens?
ifelse(TRUE, numeric(0), 1)
> [1] NA
I would expect numeric(0) of course. I suspect that this is because ifelse is vectorized, e.g. the following works, but I don't understand exactly what is going on.
if (TRUE) numeric(0) else 1
#> numeric(0)
Aucun commentaire:
Enregistrer un commentaire