How to remove NA value in R

r

#1

I want to remove NA value from my vector but I am not able to remove instead I can only know the location of NA
y<-c(1,2,NA,3)
a<-is.na(y)
a
[1] FALSE FALSE TRUE FALSE


#2

U can just use na.omit function

y<-na.omit(y)


#3

And if you know the TRUE and FALSE values, you can subset with it.

y[!a]
[1] 1 2 3