Remove NAs from one column

(See screenshot) In the twin column, I'm trying to remove NAs. Although, I don't all NAs removed from the data set because there would not be anything left, because its survey data. So how would i accomplish this?

FYI: complete.cases does not work. It removes everything

Column with "2s" in it, is the twin column

Lots of ways to do this.

In base R:

myData <- myData[!is.na(myData$twin),]

In tidyverse:

require(tidyverse)

myData %>%
    filter (!is.na(twin)) -> myData

Bear in mind - both are over writing your dataset

is.na() - means the value is NA
! - means IS NOT.

so !is.na() means IS NOT NA

Awesome. Work perfect. Thanks

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.