Skip to content
Prev 22525 / 29559 Next

How to count unique TRUE's

I'm guessing based on the data and situation you describe that some
variant of this would probably get you close:


##  Sample data:
d <- data.frame(A=c(T,F,F,T), B=c(F,T,F,T))

##  Count row-wise trues:
sum( apply(d, MARGIN=1, sum) >= 1 )


Hope that helps,
Forrest
--
Forrest R. Stevens
Ph.D. Candidate, QSE3 IGERT Fellow
Department of Geography
Land Use and Environmental Change Institute
University of Florida
www.clas.ufl.edu/users/forrest
On Tue, Mar 31, 2015 at 2:29 PM, Tom Philippi <tephilippi at gmail.com> wrote: