[Rd] format(object.size(...), units): KB, MB, and GB instead of Kb, Mb, and Gb?

Henrik Bengtsson hb at biostat.ucsf.edu
Sun Sep 7 22:15:18 CEST 2014


I cannot remember if this has already been discussed or not, and I'm a
bit worried I'm throwing off an endless debate.  If it's already
settled, no need to discuss it further.

TOPIC #1:
Shouldn't R use KB, MB and GB when reporting on sizes kilobytes,
megabytes and gigabytes?  More specifically, format() for object_size
objects (returned by object.size()) uses Kb, Mb and Gb, which AFAIK is
more often used to indicate sizes in kilobits, megabits and gigabits,
e.g.

> format(structure(2e3, class="object_size"), units="auto")
[1] "2 Kb"
> format(structure(2e6, class="object_size"), units="auto")
[1] "1.9 Mb"
> format(structure(2e9, class="object_size"), units="auto")
[1] "1.9 Gb"
> format(structure(2e12, class="object_size"), units="auto")
[1] "1862.6 Gb"

BTW, I suggest to add support for terabytes too (and maybe beyond);
we're soon/already there.


TOPIC #2:
There's also the decimal (1000^n) vs binary prefixes (1024^n)
standardization.  format() for object_size reports on 1024^n ones, cf.
utils:::format.object_size.  There are efforts to distinguish between
the two system, e.g. using KiB = 1024, MiB = 1024^2 bytes, GiB =
1024^3 bytes etc. (and KB, MB, GB for the decimal one).  However, the
KB, MB, GB is still widely used as binary prefixes when it comes to
reporting on memory and disk spaces.

The http://en.wikipedia.org/wiki/Binary_prefix page provides further
references on the above.


I don't worry to much about KiB vs KB since there is still a de facto
standard for KB etc., but to me using Kb when it should be KB seems
wrong.  Also, I have a hard time finding references to standards
suggesting Kb should be used instead of KB, but maybe I haven't looked
hard enough.

That's all.  Now, hit me back...

/Henrik



More information about the R-devel mailing list