[Rd] is.whole()
Greg Snow
538280 at gmail.com
Tue Oct 28 18:47:36 CET 2014
Just to anticipate future discussion from math purists (and hopefully
not to throw too much of a wrench in the works), what would be the
return of:
is.whole(-1)
or
is.whole(-1L)
?
I can see arguments for both TRUE and FALSE from both the math purity
group and the "what will happen when I try to use this for
subsetting?" group.
On Tue, Oct 28, 2014 at 9:14 AM, Martin Maechler
<maechler at stat.math.ethz.ch> wrote:
>>>>>> 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
>
> Martin
>
>
>
> > 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.
> >>
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
--
Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com
More information about the R-devel
mailing list