[R] Amount of memory occupied by data type

Folkes, Michael Michael.Folkes at dfo-mpo.gc.ca
Wed Mar 14 17:25:47 CET 2012

Thanks David for the details and pointer to bitops functions. Buried a
bit deep that was. 
I like to think the memory constraints of win xp keeps my code lean and
efficient.  RAM is like a suburban garage, the bigger it is, the more
useless junk people stuff in there.

Michael Folkes

-----Original Message-----
From: David Winsemius [mailto:dwinsemius at comcast.net] 
Sent: March 13, 2012 5:25 PM
To: Folkes, Michael
Cc: r-help at r-project.org
Subject: Re: [R] Amount of memory occupied by data type

On Mar 13, 2012, at 7:02 PM, Folkes, Michael wrote:

> Hello all,
> I was under the (false?) assumption that an object that is class 
> logical, would take up less memory than an object with class integer.


> Below am I correctly showing this is not the case?
> This was an attempt to reduce memory usage.

I think there is a package that will do bitwise operations. Yep... all
we needed to do is look:


> I'm dealing with two large
> arrays (could be integers).  Their contents are the exact same, but 
> one has NA's in random locations.  I thought instead of having the 
> second array as an integer, it could be logical and the TRUE vs FALSE 
> could be used to update data in the first array.  (but even this idea 
> may be weak if I just end up with a third temporary array...)

You probably would since any assignment is going to create a copy. And
even having a bitwise logical option wouldn't necessarily help since the
indexing would be of necessity either integer or logical (both 8 bit
> I'm running win xp sp3, "R version 2.14.1 (2011-12-22)".

  31-bit addressing constraints as well?  (That's so last decade.) You
aren't making life easy for yourself are you.

David Winsemius, MD
West Hartford, CT

More information about the R-help mailing list