Click here to Skip to main content
15,792,841 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So I have a data frame with 2 columns that have TRUE and FALSE values.

I want to find the rows that contain TRUE for both columns in a given row, and create a vector with Boolean values, only outputting TRUE if it meets the criteria above.

dat <- data.frame(a = c(TRUE,TRUE,FALSE), b = c(TRUE,FALSE,FALSE)
So with the code, it should output a vector with TRUE,FALSE,FALSE, since the first row contains two TRUE values, so it output TRUE while the rest output FALSE.

What I have tried:

I have tried using the apply function but don't know how to use it to extract the correct boolean values for rows that contain TRUE for both columns for each given row.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900