You can count the number of instances in which one column has a zero and the matching row has a non-zero value in R by using the dplyr
package. Here's an example to achieve that:
242 chars10 lines
This code will filter the rows where column1
has a zero and column2
has a non-zero value, then it will calculate the count of such instances.
gistlibby LogSnag