While:
while a statement is true, follow function steps
while (big < 10000) big=big^2
Repeat:
repeat infinite times
typically includes a break statement
repeat {
big=big^2
if (big > 10000) break
}
For:
#FIBONACCI EXAMPLE <3
testmat=1:10
fib = c(0,1)
for (i in testmat) {
fib=c (fib, fib[length(fib)]+fib[length(fib)-1])
}
#fib -> c(0,1,1,2,3,5,8,13,21,34,55,89)
save (object, file='\\\\\\\\filepath\\\\\\\\') #save just a single object, such as a vector
save.image(file='\\\\\\\\filepath\\\\\\\\') #saves the entire workspace
# R objects are saved as .Rdata files
# R scripts are saved as .R files
# R histories are saved as .Rhistory
load(file='\\\\\\\\filepath\\\\\\\\') #loads in the .R/.Rdata file