[R] seq: specify *minimum* end value, more elegant solution
Timothy W. Hilton
twh142 at psu.edu
Mon Aug 18 20:38:47 CEST 2008
Hello,
Using seq, I would like to specify a minumum end value, rather than a maximum end value. For example, rather than
> seq(from=0, to=10, by=4)
[1] 0 4 8
I would like to obtain
[1] 0 4 8 12
I can do that with
> by.value = 4
> seq(from=0,by=by.value,to=ceiling(10 / by.value)*by.value)
[1] 0 4 8 12
That seems like a somewhat clunky solution, though, and requires an additional variable (by.value) that shows up three times. Is there a more elegant solution to this?
Thanks!
Tim
More information about the R-help
mailing list