Rep
rep(value,repeats)
it repeats the value the number of times indicated.
#Repeat the number 4 five times.
rep(4, 5)
## [1] 4 4 4 4 4
#Repeat the sequence of values 1-5, three times.
rep(1:5, 3)
## [1] 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
#Repeat the seasons twice.
seasons=c("spring"," summer", "fall"," winter")
rep(seasons, 2)
## [1] "spring" " summer" "fall" " winter" "spring" " summer" "fall"
## [8] " winter"
Seq
seq(from = value1, to = value2, by = step)
it creates a list of numbers between value1 to value2 with increments of step
#sequence from 1 to 10:
seq(from = 1, to = 10, by = 1)
## [1] 1 2 3 4 5 6 7 8 9 10
#sequence from 0 to 20 by 2:
seq(from = 0, to = 20, by = 2)
## [1] 0 2 4 6 8 10 12 14 16 18 20