The provided "existing answer" will tell you _why_ this occurs, but doesn't explain how to change it, as you asked. You can write a custom function that checks if the input is NA, and if so returns NA, otherwise raises to the supplied power.
– Paul Stafford AllenNov 24 '22 at 09:39
1
You could redefine `^` to return `NA` if input is `NA` and return the normal value otherwise: `'^' <- function(x,y) ifelse(is.na(x),NA,.Primitive("^")(x,y))`
– shaun_mNov 24 '22 at 10:01