r - Create this vector using rep() and seq() -


this question has answer here:

i'm starting r language , have create vector using rep() , seq().

1 2 3 4 5 2 3 4 5 6 3 4 5 6 7 4 5 6 7 8 5 6 7 8 9  

i've been trying stuff but i'm not achieving it.

we can try

1:5 + rep(0:4,each=5) #[1] 1 2 3 4 5 2 3 4 5 6 3 4 5 6 7 4 5 6 7 8 5 6 7 8 9 

Comments

Popular posts from this blog

java - unable show chart in xls document using jasper reports -

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -