[R] Bug in "is" ?

Wacek Kusnierczyk Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Wed Sep 24 23:30:23 CEST 2008


Douglas Bates wrote:
> On Wed, Sep 24, 2008 at 11:08 AM,  <ctu at bigred.unl.edu> wrote:
>   
>> Thank you for all of you. Intuitively, 7 is an integer for people who live
>> in this planet. It is just very difficult for me to believe that R does not
>> think 7 is an integer but 7L is.
>>     
>>> is.integer(7)  # R 2.7.2
>>>       
>> [1] FALSE
>> Thus, based on Martin's comments, I try it again on the S-PLUS 8.0 and it
>> shows
>>     
>>> is.integer(7)   # S-PLUS 8.0
>>>       
>> [1] T
>>
>> Hopefully, someday and someone will fix it therefore, R users don't need to
>> use as.integer(7) to tell R that 7 is an integer.
>>     
>
> My father taught me at an early age not to criticize the way that
> someone else does something until after you have shown that you can do
> it better.  The fact that you don't agree with a design decision
> doesn't mean that it is wrong and should be "fixed".
>
> We look forward to using the system for computing with data that you
> will develop and make freely available and in which 7 will be stored
> as an integer.  In the meantime, if you want to use R then you will
> just need to grit your teeth and accept that literal constants like
> '7' are stored as floating point values and literal constant like '7L'
> are stored as integers.
>
>
>   

good god.  my father taught me that if i want to do business, or if i
just want to do favours, i should listen to the customers.  'shut up and
accept our design if you want to use our product', esp. if there are 
design issues which apparently cause *unnecessary* confusion, is kinda
arogant. 

you don't need to be an emperor to be able to see that an emperor is
naked;  you'd better listen to -- and encourage -- folks that give you
feedback, rather than trash them. 

of course, it is not an objective truth that letting integer(7) evaluate
to FALSE is wrong; in Oz, for example, you can't add an integer to a
float, and in Perl you can add whatever number to whatever string. 
these designs have their merits, and the 'how it is stored' story about
7 is not unreasonable -- but it does seem to be a wrong decision for a
language focused mostly with statistical computations and not computer
science concerned with how to represent an integer.  you can always
design a language where 7 is stored as a string by default, but it
should be fine to listen to your users what they think about it.

sorry for the reaction, but i thought you've missed something you
shouldn't have.
vQ



More information about the R-help mailing list