[R] conv() example in R-exts

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Nov 8 10:23:46 CET 2004


On Mon, 8 Nov 2004, Robin Hankin wrote:

> [I'm not sure if this is "intelligible to non-programmers" or not]

Not, I suspect:  R-exts is not intended to be.

> R-exts  (section 4.2) gives an example  of the .C() function whose 
> third argument is
> 
> "as.integer(length(a))",
> 
> and urges the user to coerce all the arguments to the correct form 
> (on pain of  "hard-to-catch errors"
> which I now know to be very appropriate, if understated,  phrasing).
> 
>   The length()  function returns an integer, according to the helppage.
> 
> So, why does the argument above use as.integer()?

Because things written on help pages can change.

There *is* a potential issue here, as 64-bit platforms could support
longer vectors than an R integer can represent.  I suspect before too long
we will need a `size' type for lengths.  Already object.size() has been 
changed to return a double, not an integer, since people are created 
objects of more than 2Gb in size.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list