If you want to count out a sequence of number in R, you can simply use a :
1:15 goes from 1 to 15, while 6:22 goes from 6 to 22
You can even assign these sequences to a variable, creating a vector
However, you can only count by 1 using this method.
seq()
With seq(1,15) I can count from 1 to 15, just like using 1:15
If I add a third argument though, now I am counting from 1 to 15 by 4
rep()
rep() stands for replicate. Using rep(), I can make a list of repeating elements
You can of course create vectors with both seq() and rep() by assigning them to a variable
Remember R indexes start at 1 not 0
so using the vector above, a[3] = 9 – a[1:3] = 1,5,9