This should deliver the desired subset using ordinary logical indexing and logical operators:
newNCNT <- NCNT[ NCNT[[2]] == "." & NCNT[[3]] == ".", ]
In order to use the subset
function one would ordinarily need to know the column names for those two columns. If one knew the names to be name1
and name2
then it might be:
newNCNT <- subset( NCNT, name1 == "." & name2 == ".")
This will deliver rows where both values in those columns are ".". Many people have difficulty expressing their desired logical operations correctly, so if you wanted rows with either column 2 or column 3 having a missing value then you would need the |
(OR) operator. @docendodiscimus apparently thought you wanted the latter.