You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.2 KiB
R
34 lines
1.2 KiB
R
% Generated by roxygen2: do not edit by hand
|
|
% Please edit documentation in R/numeric.R
|
|
\name{numbers2prefix}
|
|
\alias{numbers2prefix}
|
|
\title{Format numbers using SI unit prefixes}
|
|
\usage{
|
|
numbers2prefix(number, rounding = FALSE, digits = ifelse(rounding, NA, 6))
|
|
}
|
|
\arguments{
|
|
\item{number}{number, numeric vector}
|
|
|
|
\item{rounding}{rounds number to nearest integer (default FALSE), boolean}
|
|
|
|
\item{digits}{if rounding=FALSE, lets you specify significant figures (default 6), numeric}
|
|
}
|
|
\value{
|
|
number followed by SI prefix (as character string,
|
|
separated by narrow no-break space)
|
|
}
|
|
\description{
|
|
Using SI unit prefixes is a more compact way to write very large or very small
|
|
numbers which can sometimes be useful. This function takes a number (or a vector
|
|
of numbers) and returns the equivalent value expressed using the nearest prefix.
|
|
My thanks to https://stackoverflow.com/users/843265/tomelgin for posting the
|
|
code that this function was based on (see first link below).
|
|
}
|
|
\seealso{
|
|
https://stackoverflow.com/questions/11340444/convert-numbers-to-si-prefix
|
|
|
|
https://stackoverflow.com/questions/28159936/format-numbers-with-million-m-and-billion-b-suffixes
|
|
|
|
https://www.nist.gov/pml/owm/metric-si-prefixes
|
|
}
|