Skip to content
Prev 332975 / 398503 Next

repeating values in an index two by two

function(x) {
     one <- matrix(1:x, nrow=2)
     as.vector(rbind(one, one))
}
<environment: 0x000000000daaf1c0>
 > f1(8)
  [1] 1 2 1 2 3 4 3 4 5 6 5 6 7 8 7 8

Pat
On 11/11/2013 12:11, Federico Calboli wrote: