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
Hello,
I am a newbie in R and I have a problem.
I want this line:
newMyData <-MyData[!(is.na(col1)) | !(is.na(col2)) | !(is.na(col3)) | !(
is.na(col4)) | !(is.na(col5)),]
write in for loop. The number of col[number] may be different from 3 to 8
Is there any ideas?
Thank you
Laura
[[al
3 matches
Mail list logo