How can I substitute NA values by zero in a R zoo series?
I've been reading about na.locf and na.omit but I think none of them do what I need.
thanks.
I'm not familiar with the Zoo Series but this is how you do it with vectors. This Should work.
x = c(NA,1,2,3)
x[ is.na(x) ] <- 0
print (x)
Use na.fill. If z is the zoo series:
na.fill(z, fill = 0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With