I need to create a pattern like this with the rep()
and seq()
commands.
It should look like this:
[1] 0.0 0.0 0.0 0.8 0.8 0.8 1.6 1.6 1.6 2.4 2.4 2.4 3.2 3.2 3.2 4.0 4.0 4.0 4.8
[20] 4.8 4.8
Do you have any idea how to do so?
This will work:
rep(seq(0,4.8,by=0.8),each=3)
[1] 0.0 0.0 0.0 0.8 0.8 0.8 1.6 1.6 1.6 2.4 2.4 2.4 3.2 3.2 3.2 4.0 4.0 4.0 4.8 4.8 4.8