When I execute:
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 output length) 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 strange. I think both of these commands should perform the same function. Can anybody help?
Thanks!
source share