Last active
September 8, 2022 10:16
-
-
Save DrNickRedfern/085ed7b804b743abc8d68a0db210a6ee to your computer and use it in GitHub Desktop.
An illustration of an ifelse statement in R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a <- 2 | |
if (a > 0){ | |
print(paste0(a, " is a positive number")) | |
} else if (a < 0) { | |
print(paste0(a, " is negative number")) | |
} else { | |
print(paste0(a, " equals zero")) | |
} | |
[1] "2 is a positive number" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment