Nested ifelse Statement in R (2 Examples) | How to Nest If & Else Function | TRUE & FALSE Conditions

preview_player
Показать описание
R code of this video:

ifelse(test = 5 > 3, # First test condition

yes = ifelse(test = 5 > 4, # Second test condition
yes = "TRUE Twice",
no = "Yes & No"),

no = "No")

Follow me on Social Media:
Рекомендации по теме
Комментарии
Автор

Thanks for the insight, Joachim!! :-D

agsoutas
Автор

Another brilliant video Joachim! thank you! I'm trying to do something related - Is there a way to use if & else to look through a dataframe column, and determine if a specific cell is a positive number (0 or >) and if so put that exact value in a certain column, otherwise (if negative) put that negative value in a different column?

robertdeering
Автор

Quick unrelated question. If I have a table with two columns, is there a way that I can delete all rows in which the value of column 2 is greater than column 1. So if I had
1 2
2 2
3 2
It would delete row 1 as 2 is bigger than 1

dylan