s-news
[Top] [All Lists]

[S] Storage space hint

To: "'s-news@wubios.wustl.edu'" <s-news@wubios.wustl.edu>
Subject: [S] Storage space hint
From: Michael Camilleri <branzmtc@branz.org.nz>
Date: Thu, 30 Sep 1999 09:20:34 +1200
Sender: owner-s-news@wubios.wustl.edu
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

<Prev in Thread] Current Thread [Next in Thread>
  • [S] Storage space hint, Michael Camilleri <=