[R] storage and single-precision

Duncan Murdoch murdoch.duncan at gmail.com
Thu Sep 8 11:51:35 CEST 2011

On 11-09-07 6:25 PM, Mike Miller wrote:
> I'm getting the impression from on-line docs that R cannot work with
> single-precision floating-point numbers, but that it has a pseudo-mode for
> single precision for communication with external programs.
> I don't mind that R is using doubles internally, but what about storage?
> If all I need to store is single-precision (32-bit), can I do that?  When
> it is read back into R it can be converted from single to double (back to
> 64-bit).
> Furthermore, the data are numbers from 0.000 to 2.000 with no missing
> values that could be stored just as accurately as unsigned 16-bit integers
> from 0 to 2000.  That would be the best plan for me.

writeBin is quite flexible in converting between formats if you just 
want to store them on disk.  To use nonstandard formats in memory will 
require external support; it's not easy.

Duncan Murdoch

> It looks like the ff package allows for additional formats, so I might try
> to use ff, but I still would like to get a better understanding of R's
> native capabilities in regard to representations of numbers both in RAM
> and in stored data files.
> Thanks in advance.
> Best,
> Mike
> --
> Michael B. Miller, Ph.D.
> Minnesota Center for Twin and Family Research
> Department of Psychology
> University of Minnesota
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list