formatBytes: Format a number of bytes into a human readable string.

Description Usage Arguments Examples

Description

Formats a number of bytes into a human readable string.

When invoked as formatBytes, SI sizes are used. You may specify IEC sizes by using formatIECBytes.

Usage

1
2
3
  formatBytes(b, fmt="%.2f")
  formatSIBytes(b, fmt="%.2f")
  formatIECBytes(b, fmt="%.2f")

Arguments

b

Number of bytes

fmt

String format for the numeric part of the bytes

Examples

1
2
3
4
5
6
7
8
  # returns "934.82MB"
  formatBytes(934818582)

  # returns "891.51MiB"
  formatIECBytes(934818582)

  # returns c("8.43KB", "3.52KB", "624.62KB", "46", "7.36KB")
  formatBytes(c(8429, 3525, 624624, 46, 7357))

humanFormat documentation built on May 1, 2019, 10:19 p.m.