Week 2 from Quizlet Flashcards
control structures in R allow you to…
control the flow of execution of the program
if, else
testing a condition
for
execute a loop a fixed number of times
while
executes a loop while a condition is true
repeat
execute an infinite loop
break
break the execution of a loop
next
skip an interaction of a loop
return
exit a function
What is a loop index shown as
i
loop index
A counter variable used in For / Next loop.
seq_len()
Generate regular sequences. and the length
seq_along()
Generate regular sequences.
subset()
Return subsets of vectors, matrices or data frames which meet conditions.
How to stop an infinite loop
break
how to skip a part of a loop
next
How to tell R to exit a function and return a given value
return
what function do you use to construct a function?
function()