I have a table (737:35) which has different values for missing observations, e.g. NA, 0, n/a or --
So, the table looks like this:
┌────┬────┬──────┬──────┬──────┬──────┬──────┐
│ X │ Y │ 2010 │ 2011 │ 2012 │ 2013 │ 2014 │
├────┼────┼──────┼──────┼──────┼──────┼──────┤
│ A │ XY │ 0 │ 0 │ 0 │ 10 │ 15 │
│ A │ XZ │ 11 │ 13 │ n/a │ 12 │ 14 │
│ B │ XY │ 0 │ -- │ 0 │ 7 │ -- │
│ B │ XZ │ 15 │ 16 │ 12 │ 13 │ 14 │
│ C │ XY │ NA │ NA │ NA │ NA │ NA │
│ C │ XZ │ 8 │ 12 │ 11 │ n/a │n/a │
└────┴────┴──────┴──────┴──────┴──────┴──────┘
I want to delete all rows which have a value of either NA, 0, n/a or --, so I end up having only row 5 in this example
I could get rid of the rows with NA using is.na()
and deleted the rows with a 0 in the column 2010 using grep()
; could someone tell me how I can delete all rows missing an observation in an easy way?