Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
5
Task/Conditional-structures/R/conditional-structures-1.r
Normal file
5
Task/Conditional-structures/R/conditional-structures-1.r
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
x <- 0
|
||||
if(x == 0) print("foo")
|
||||
x <- 1
|
||||
if(x == 0) print("foo")
|
||||
if(x == 0) print("foo") else print("bar")
|
||||
2
Task/Conditional-structures/R/conditional-structures-2.r
Normal file
2
Task/Conditional-structures/R/conditional-structures-2.r
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
x <- 2
|
||||
switch(x, print("Print if x == 1"), print("Print if x == 2"))
|
||||
4
Task/Conditional-structures/R/conditional-structures-3.r
Normal file
4
Task/Conditional-structures/R/conditional-structures-3.r
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
x <- 3
|
||||
switch(x, print("Print if x == 1"), print("Print if x == 2"))
|
||||
x <- 2.7
|
||||
switch(x, print("Print if x == 1"), print("Print if x == 2 or if there is rounding to 2"))
|
||||
6
Task/Conditional-structures/R/conditional-structures-4.r
Normal file
6
Task/Conditional-structures/R/conditional-structures-4.r
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
x <- "match"
|
||||
switch(x, mat = 0, match = 10, other = 100, 1000)
|
||||
x <- "ma"
|
||||
switch(x, mat = 0, match = 10, other = 100, 1000)
|
||||
x <- "foo"
|
||||
switch(x, mat = 0, match = 10, other = 100, 1000)
|
||||
2
Task/Conditional-structures/R/conditional-structures-5.r
Normal file
2
Task/Conditional-structures/R/conditional-structures-5.r
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
data <- c(1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0)
|
||||
ifelse(data == 1, "Yes", "No")
|
||||
Loading…
Add table
Add a link
Reference in a new issue