## this is much easier to read
riffle3 <- function(a, b) {
mlab <- min(length(a), length(b))
seqmlab <- seq(length=mlab)
c(rbind(a[seqmlab], b[seqmlab]), a[-seqmlab], b[-seqmlab])
}
riffle3((1:10),(50:55))
## [1] 1 50 2 51 3 52 4 53 5 54 6 55 7 8 9 10
riffle3((50:55),(1:10))
## [1] 50 1 51 2 52 3 53 4 54 5 55 6 7 8 9 10
riffle3((1:7),(8:14))
## [1] 1 8 2 9 3 10 4 11 5 12 6 13 7 14
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.