Behavior of seq with vector from
Rowe, Brian Lee Yung (Portfolio Analytics) wrote:
....
To get the value I want, I am using the following code:
sort(as.vector(apply(array(c(2,3)), 1, seq, by=3,length.out=4)))
[1] 2 3 5 6 8 9 11 12 So two questions: 1. Is seq designed/intended to be used with a vector from argument, and is this the desired behavior? 2. If so, is there a cleaner way of implementing what I want?
1. Hmm, not really. NA. 2. I'd view it as an outer sum, stringed out to a single vector, hence:
c(outer(c(2,3), seq(0,,3,4), "+"))
[1] 2 3 5 6 8 9 11 12
O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907