Loops

While:

Repeat:

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)

Saving Things

Via Code:

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