dear all!
So basically what I have are two numerical vectors:
A <- c( 1, 2, 3, 4, 6, 7 ) B <- c( 8, 9, 10, 11, 12, 13 )
and I would like to combine them so that the result would be:
1, 8, 2, 9, 3, 10, 4, 11, 6, 12, 7, 13
i.e. that the first element of B is next to the first of A and so on.
One way to do that is using paste
, but that's really not nice coding...
as.numeric( unlist( strsplit( paste( A, B, sep=":" ), split=":" ) ) ) [1] 1 8 2 9 3 10 4 11 6 12 7 13
is there any other, better way to achieve the same.
thanks in advance!
jo
Awesome! About 4x faster than my C1 method!