From: Omar Lakkis <uofiowa_at_gmail.com>

Date: Sat 25 Jun 2005 - 02:54:29 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jun 25 02:57:31 2005

Date: Sat 25 Jun 2005 - 02:54:29 EST

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?

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jun 25 02:57:31 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:33:02 EST
*