[R] Amount of memory occupied by data type

David Winsemius dwinsemius at comcast.net
Wed Mar 14 01:25:23 CET 2012

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 values).
> 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