Re: [R] Help with rep

2008-07-25 Thread Dimitris Rizopoulos
try this: st <- 5 unlist(lapply(st:1, seq, to = st)) I hope it helps. Best, Dimitris Dimitris Rizopoulos Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.ku

Re: [R] Help with rep

2008-07-25 Thread Gabor Csardi
Jacob, yes, e.g. rep( c(4,3,4,2,3,4,1,2,3,4), 1 ) :) Seriously, your question reminds me of (rather silly) television contents, when one should find _the_ rule in a series of numbers. :) Here is a solution, assuming I've found the "correct" rule: unlist(lapply(4:1, seq, 4)) Best, Gabor On Fri

Re: [R] Help with rep

2008-07-25 Thread Peter Dalgaard
Van Wyk, Jaap wrote: Hi Is it possible to use the rep command (or maybe some other "shortcut") to create a vector with the following format: 4 3 4 2 3 4 1 2 3 4 I don't see a rep() solution, but > unlist(lapply(4:1, seq, to=4)) [1] 4 3 4 2 3 4 1 2 3 4 -- O__ Peter Dalgaa