When I perform:
rep(1:4, rep(4,4))
I get
1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4
which is expected. But then when I try to fix the length to 16(which is the length of the output) as follows:
rep(1:4, rep(4,4), length.out = 16)
I get
1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4
which is weird. I think both of these commands should perform the same function. Can someone please help?
Thanks!
?rep
– Dioscuri