This lesson demonstrates how to analyze multiple data sets by sending them through a for loop.
len <- 0
vowels <- c("a", "e", "i", "o", "u")
for (v in vowels) {
len <- len + 1
}
len
Upon completion of the preceding loop, the value of the variable len will be:
1. 0
2. 1
3. 6
4. 5
letter <- "z"
for (letter in c("a", "b", "c")) {
print(letter)
}
Upon loop completion, the loop variable in the example above: