[R] seq in R
Omar Lakkis
uofiowa at gmail.com
Fri Jun 24 18:54:29 CEST 2005
I want to generate a sequence from 1 to x by 1
seq(1,x,by=1)
I want the above to return an empty list if x is zero
In other languages I can do 1:x:1 to force the increment by to be a
positive 1. This syntax does not work in R. In R 1:x gives me
1 0
when x is zero, this is not what I want.
The seq statement above throws an error when x is 0.
How can I generate a sequence where if the "to" value is less than the
"from" value an empty list is generated with no errors?
More information about the R-help
mailing list