I have a very long data frame (~11 million x 130) for which is sparsely filled with percentages (0.00 - 100.00, float).
The entries that are missing are labeled "NA", like so:
cat1 NA NA 99.90 NA NA 10.90 NA cat2 NA 1.00 NA 19.12 NA NA NA cat3 NA NA NA NA NA NA 45.00
I want to go through this data frame row by row and sum up the occurrences of "NA".
I can normally accomplish this very easily in R by doing
apply(data.frame, 1, function(x) sum(is.na(x)), but because the file is so large I keep having memory problems. I'd like to do this with AWK if possible so that I can apply this on the command line for future similar problems.
I am not great with awk, but I essentially want to sum the occurrences of "NA" across fields for each record/row and then later I can use this as an index for skipping lines of the file.
Thanks in advance