How to Use a Nested ifelse Statement in R (Example Code)

This tutorial explains how to apply nested ifelse statements in the R programming language.

Example: Nested ifelse Statement with Multiple TRUE Conditions

ifelse(1 < 2,               # Testing first logical condition
       ifelse(2 < 2,        # Testing second logical condition
              "TRUE & TRUE",
              "TRUE & FALSE"),
       "FALSE")
# "TRUE & FALSE"

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top