Skip to main content

R

Iterations​

for​

f <- function(v){
#code
}

x <- 1:10
for (val in x) {
print(paste("Iteration number ", val))
}

while​

i <- 1
while(i <= 10) {
print(paste("Iteration number ", i))
i = i + 1
}

Functions​

simple function​

f <- function(){
#code goes here
}