In addition to which, the original question uses an incorrect way to reference
columns in the data frame.
It should probably have been:
newMyData <-MyData[!is.na(MyData$col1) | !is.na(MyData$col2) |
!is.na(MyData$col3) |
!is.na(MyData$col4) | !is.na(MyData$col5) , ]
That is assuming that "col
Dear Laura,
It looks like you want to remove all rows for which each column is NA.
You can to that with the code below.
na.matrix <- is.na(MyData)
all.na.row <- apply(na.matrix, 1, all)
MyData[!all.na.row, ]
Best regards,
ir. Thierry Onkelinx
Statisticus / Statistician
Vlaamse Overheid / Gove
2 matches
Mail list logo