[Rd] is.whole()

Martin Maechler maechler at stat.math.ethz.ch
Tue Oct 28 16:14:07 CET 2014

>>>>> Therneau, Terry M , Ph D <therneau at mayo.edu>
>>>>>     on Tue, 28 Oct 2014 07:44:20 -0500 writes:

    > Martin,
    > I can't imagine using such a function myself, the reason being that as Bill and Duncan 
    > point out, the correct answer depends on the situation.

yes, of course.
OTOH, if the function is used for argument checking inside
another function, using such an  is.whole(.)  may come as a
handy, and well readable {because self explaining} expression.

    > But given the regular reappearance of this topic, I think that perhaps creation of your 
    > function is a good idea, largely to function as a repository for the knowlege.  If one 
    > takes that view, then perhas the function has two optional arguments: "case" and 
    > "tolerance".  The first would choose a scenario of "exact", "numeric", "count", etc, where 
    > exact refers to Duncan's case, numeric to your default, and count to Bill's  a+1 > a.  The 
    > second argument would be rarely used.

    > The primary point of the function would be the "Details" section of its manual page. 
    > Whenver the issue comes up the response could then be "see the is.whole() function and its 
    > documentation".

    > Terry T.

Thank you, Duncan, and Terry,

Yes, indeed, a primary point of the function would just be that:
A coherent place to point to (and \link{.} to e.g. from the
as.integer help page).

Apropos optional arguments and their defaults: It may indeed be
a better (than sfsmisc::is.whole 's default) idea to use a
default tolerence = 0 rather than  sqrt(.Machine$double.eps). ..
and I think the argument / principle of thinking of what happens
when "integer - indexing" with such numbers is also aa good one.
That one has the drawback of asymmetry, i.e., of treating  
4 + 1e-10 very differently than
4 - 1e-10


    > On 10/28/2014 06:00 AM, r-devel-request at r-project.org wrote:
    >> Diverted to R-devel, as I'm requesting comments about a proposal
    >> to add is.whole() to R just so this issue does not trail on for
    >> centuries (;-), see below.

More information about the R-devel mailing list