Is there a way to use a 32-bit float instead of a 64-bit in R-data frames?

Memory issue. I do financial calculations on the amount in dollars, and currently my floating point accuracy is 64 bits. I would like to reduce the accuracy to 32 bits, but have not yet found a way to specify this in R. Ideally, this just applies to a data frame that has several columns, some of which are int and some are floats.

+5
source share
1 answer

No, no, at least not in the "base R", which has only one type integer and numeric (floating point), and their sizes are fixed.

You can check them (and much more) through .Machine - see help(".Machine") .

Now, for your dollar amounts, you could certainly resort to cents, and in this case you could integer , which is usually half the size of numeric .

+7
source

All Articles