From pauljohn32 at gmail.com  Wed Aug  3 22:12:42 2016
From: pauljohn32 at gmail.com (Paul Johnson)
Date: Wed, 3 Aug 2016 15:12:42 -0500
Subject: [Rd] seq.int does not return a sequence of integers sometimes
Message-ID: <CAErODj_hSunpyZug+dbH7rLuBJuUtsnNvjK_4ii=Pwct6W-1mg@mail.gmail.com>

I have a script that goes wrong because I assumed that seq.int would
return integers.

Below please see it does not unless user is super cautious about
inserting "L" with inputs. I think seq.int should do coercion for me
before returning the sequence.

> xx <- seq.int(1,10)
> class(xx)
[1] "integer"
> is.integer(xx)
[1] TRUE
> xx <- seq.int(1,10, 2)
> class(xx)
[1] "numeric"
> is.integer(xx)
[1] FALSE
> xx <- seq.int(1,10, 2L)
> class(xx)
[1] "numeric"
> is.integer(xx)
[1] FALSE
> xx <- seq.int(1L, 10L, 2L)
> class(xx)
[1] "integer"
> is.integer(xx)
[1] TRUE


I think all of those should have same return value, if the function is
correctly named seq.int.

-- 
Paul E. Johnson   http://pj.freefaculty.org
Director, Center for Research Methods and Data Analysis http://crmda.ku.edu

I only use this account for email list memberships. To write directly,
address me at pauljohn at ku.edu.



[Rd] seq.int does not return a sequence of integers sometimes
Paul Johnson