I have a sample vector with NA, I want to replace these NA with NULL
ts<-c(12,NA,45,16,48,69,NA,3)
I tried this but it didn't work
ts[is.na(ts)]<-NULL
is there anyway to do this? Thanks.
As far as i know a vector can't contain the value NULL. It will just get omitted. For example
ts <- c(1,2,NULL,NULL)
ts
[1] 1 2
Why do you want to do this replacement in the first place?
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