[R] how to force a big array to be integer type

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jan 2 20:31:10 CET 2002


Does

storage.mode(Array) <- "integer"

do what you want?

Array[] <- as.integer(Array)

is I think the same operation. Both preserve the dim and dimnames and
any other attributes.


On Wed, 2 Jan 2002, Jason Liao wrote:

> First, happy new year to everyone, especially to Prof. Ripley, who has
> kindly answered my previous questions.
>
> I need to use an array to store a large number of integers. My question
> is how to force an array to be integer for storage.type. This will save
> memory (from 8 bytes real to 4 bytes integer). Also I need to compare
> integers and I want their representation to be exact.
>
> Thanks for your help.
>
> Jason
>
>
>
>
> =====
> Jason G. Liao, Ph.D.
> Division of Biometrics
> UMDNJ School of Public Health
> 335 George Street, Suite 2200
> New Brunswick, NJ 08903-2688
> phone (732) 235-9748, fax (732) 235-9777
> http://www.geocities.com/jg_liao
>
> __________________________________________________
>
>
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list