Re: [R] is.integer() function

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Thu 26 Jan 2006 - 04:36:11 EST

On 1/25/2006 10:57 AM, Barry Rowlingson wrote:
> Gabor Csardi wrote:

>> Becaues is.integer shows the internal representation, which is not an
>> integer but a double (real number). Some functions create integer vectors,

>
> Some functions that you might think create integer vectors and even
> seem to say they create integer vectors dont create integer vectors:
>
> 'ceiling' takes a single numeric argument 'x' and returns a
> numeric vector containing the smallest integers not less than the
> corresponding elements of 'x'.
>
> > ceiling(0.5)
> [1] 1
>
> > is.integer(ceiling(0.5))
> [1] FALSE
>
> > is.integer(1:3)
> [1] TRUE
> > is.integer(ceiling(1:3))
> [1] FALSE
>
>
> This could possibly be a documentation problem, since ?ceiling is
> using 'integer' in the sense of 'whole number', whereas ?is.integer is
> concerned with internal representation (aka 'storage mode')....

Here "numeric vector" is being used in the R-specific technical sense as a vector of double precision values, so the documentor was trying hard to be precise. The problem is that English also admits the interpretation in a non-technical sense as a vector of numbers. I believe your country is to blame for the language. :-)

Duncan Murdoch

>
> This seems to be an endless source of confusion to anyone who didn't
> start their programming days in Fortran, C, or assembly language (or
> other strongly-typed language, I guess).
>
> Barry
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jan 26 04:45:15 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:10 EST