For the construct a:b, we get an error if either 'a' or 'b' is empty, e.g. > x <- integer(0) > x:3 Error in x:3 : argument of length 0 > 3:x Error in 3:x : argument of length 0
However, for length(a) > 1 or length(b) > 1, we only get a warning; > x <- 1:2 > x:3 [1] 1 2 3 Warning in x:3 : In x:3 : numerical expression has 2 elements: only the first used > 3:x [1] 3 2 1 Warning message: In 3:x : numerical expression has 2 elements: only the first used I'd like to suggest to update R to produce an *error* whenever length(a) != 1 or length(b) != 1. For example, > x <- 1:3 > x:3 Error in x:3 : argument is not of length one > 3:x Error in 3:x : argument is not of length one The code involved is in the native function do_colon() of src/main/seq.c. /Henrik ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel