Back
Close

Computing with Data

elgeish
31.2K views
Previous: Functions Next: Loops

Conditionals

The flow of control of R code is very similar to that of other programming languages. Below are some examples:

a = 10
b = 5
c = 1
if (a < b) {
d = 1
} else if (a == b) {
d = 2
} else {
d = 3
}
d
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants