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.dalga...@biostat.ku.dk)              FAX: (+45) 35327907

______________________________________________
R-help@r-project.org 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.

Reply via email to