Skip to content

Commit

Permalink
add new SI prefixes R and Q
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@83371 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
maechler committed Nov 21, 2022
1 parent 593df74 commit cd2d0ba
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions doc/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@
\item \code{type.convert()} and hence \code{read.table()} get new
option \code{tryLogical = TRUE} with back compatible default. When
set to false, converts \code{"F"} or \code{"T"} columns to character.

\item \code{object.size(*, standard="SI")} uses the new unit prefixes
\code{"R"} and \code{"Q"} for sizes above \eqn{10^{27}} bytes, thanks
to Henrik Bengtsson's \PR{18435}.
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/library/utils/R/object.size.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ format.object_size <- function(x, units = "b", standard = "auto", digits = 1L, .
{
known_bases <- c(legacy = 1024, IEC = 1024, SI = 1000)
known_units <- list(
SI = c("B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"),
SI = c("B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB",
"RB", "QB"),
IEC = c("B", "KiB", "MiB", "GiB","TiB","PiB", "EiB", "ZiB", "YiB"),
legacy = c("b", "Kb", "Mb", "Gb", "Tb", "Pb"),
LEGACY = c("B", "KB", "MB", "GB", "TB", "PB") # <- only for "KB"
Expand Down
6 changes: 4 additions & 2 deletions src/library/utils/man/object.size.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ object.size(x)
\code{"B"}, \code{"KiB"}, \code{"MiB"}, \code{"GiB"},
\code{"TiB"}, \code{"PiB"}, \code{"EiB"}, \code{"ZiB"} and \code{"YiB"}.}
\item{\code{standard = "SI"}:}{
\code{"B"}, \code{"kB"}, \code{"MB"}, \code{"GB"}, \code{"TB"},
\code{"PB"}, \code{"EB"}, \code{"ZB"} and \code{"YB"}.}
\code{"B"}, \code{"kB"}, \code{"MB"}, \code{"GB"}, \code{"TB"}, \code{"PB"},
\code{"EB"}, \code{"ZB"}, \code{"YB"}, \code{"RB"}, and \code{"QB"}.}
}
For all standards, \code{unit = "auto"} is also allowed.
If \code{standard = "auto"}, any of the "legacy" and \acronym{IEC}
Expand Down Expand Up @@ -111,6 +111,8 @@ object.size(x)
1000^6 \tab 1 EB \cr
1000^7 \tab 1 ZB \cr
1000^8 \tab 1 YB \cr
1000^9 \tab 1 RB \cr
1000^10 \tab 1 QB \cr
}
}
\value{
Expand Down

0 comments on commit cd2d0ba

Please sign in to comment.