Check if at least two or more booleans or conditions are True in R and Debugging in R

But, what do you do when you want to find out if at least two or more of the conditions are true?

You take advantage of the Boolean math!   Here’s how:

# for at least two of the conditions being true

if ( ((condA) + (condB) + (condC) + (condD)) >=2 ) {

# something happens here

}

For more, check out: https://psycnotes.wordpress.com/at-least-2-or-more-boolean-conditions/

Now, I also have another post about Debugging in R, which uses the debug()

https://psycnotes.wordpress.com/how-to-debug-a-function-in-r/

Advertisements

Tags: , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: