[Rd] seq.int/seq.default

Mick Jordan
Tue, 03 Jan 2017 15:57:15 -0000

This is a message for someone familiar with the implementation.

Superficially the R code for seq.default and the C code for seq.int
appear to be semantically very similar. My question is whether, in fact,
it is intended that behave identically for all inputs. I have found two
cases so far where they differ, first that seq.int will coerce a
character string to a real (via Rf_asReal) whereas seq.default appears
to coerce it to NA and then throws an error:

 > seq.default("2", "5")
Error in seq.default("2", "5") : 'from' cannot be
NA, NaN or infinite
 > seq.int("2", "5")
[1] 2 3 4 5
 >

and second, that the error messages for non-numeric arguments differ:

seq.default(to=quote(b), by=2)
Error in is.finite(to) : default method not implemented for type
'symbol'

seq.int(to=quote(b), by=2)
Error in seq.int(to = quote(b), by = 2) :
   'to' cannot be NA, NaN or infinite


Please reply off list.

Thanks
Mick Jordan