[19369] in s-news-athena
RE: [S] Storage space hint
daemon@ATHENA.MIT.EDU (David Smith)
Fri Oct 1 05:36:48 1999
Message-Id: <5FD4320911EDD21194CB00C04F8EEB1B087866@tech_1.mathsoft.co.uk>
From: dsmith@mathsoft.co.uk (David Smith)
To: "'Michael Camilleri'" <branzmtc@branz.org.nz>,
"'s-news@wubios.wustl.edu'" <s-news@wubios.wustl.edu>
Date: Fri, 1 Oct 1999 10:30:38 +0100
Mime-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
This is a useful hint, but I'd add a couple of comments:
* Storing objects as single precision will reduce the amount of disk space
the object requires, but it won't necessarily reduce your memory
requirements if you pass the object to certain functions. This is because
functions such as lm() which pass data to a C or Fortran routine will
probably have to convert it to double precision first. (Most of the
underlying C and Fortran code in S-PLUS is now double-precision.)
* convert.col.type was undocumented in S-PLUS 4.5, but *is* documented in
S-PLUS 2000. It's not available on the Unix versions of S-PLUS.
# David
--
David M Smith (dsmith@mathsoft.co.uk)
Mathsoft International, Bagshot, UK
Tel +44 01276 452299 x212
Fax +44 01276 451224
> -----Original Message-----
> From: owner-s-news@wubios.wustl.edu
> [mailto:owner-s-news@wubios.wustl.edu]On Behalf Of Michael Camilleri
> Sent: 29 September 1999 22:21
> To: 's-news@wubios.wustl.edu'
> Subject: [S] Storage space hint
>
>
>
> For those that don't know already, you can half the storage
> space for a
> numeric object by specifying single precision. There are at
> least 3 ways to
> do this:
>
> 1) For a vector:
> storage.mode(x) <- "single"
>
> 2) For a matrix or data frame
> data <- convert.col.type(target = data, column.spec = 1:ncol(data),
> column.type = "single")
> This function appears to be undocumented
>
> or for(i in 1:ncol(data)) storage.mode(data[,i]) <- "single"
>
> 3)Use the Data|Change Data Type menu (which calls (2))
>
> Well worth doing if you have large data sets and don't need
> double precision
> accuracy. It does not appear to affect any Splus analyses.
>
> use the object.size(x) function to find out how many bytes
> your object uses.
>
> Cheers!
> Michael Camilleri
> --------------------------------------------------------------
> ---------
> This message was distributed by s-news@wubios.wustl.edu. To
> unsubscribe
> send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
> message: unsubscribe s-news
>
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news