The following R program uses the na.omit() function:
> x<-c(NA,1,2,50,NA) > y<-na.omit(x) > mean(x) [1] NA > mean(y) [1] 17.66667
Another R function called na.exclude() could be used as well. The following Python program removes all sp.na code:
import scipy as sp x={2,4,3,sp.nan,6,sp.nan,7} print(x) x.remove(sp.nan) print(x)
For brevity, we omitted the output.