'Count number of instances where a blank exists in one of 2 columns + r

I need to test a dataframe for completion of records - for the records to be complete an entry must be made in both columns. In in the example df below you will see that 2 of the 9 entries contain blanks in one of the rows.

df <- data.frame(a = c(1,2,"",4,5,6,7,"",8,9),
                 b = c(9,5,2,7,5,"",3,"",6,8))

The desired output would be a count of 2 or 7 identifying the number of records that are complete or conversely incomplete. Instances where both are blanks would not be considered in the count.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source