View source: R/adjustUnitPrefix.R
adjustUnitPrefix | R Documentation |
This function provides help converting values with with different unit-prefixes to a single prefix-unit type. This can be used to convert a vector of mixed prefixes like 'p' and 'n'. Any text to the right of the unit will be ignored.
adjustUnitPrefix(
x,
pref = c("z", "a", "f", "p", "n", "u", "m"),
unit = "sec",
sep = c(".", " ", ""),
headingTxt = "",
silent = FALSE,
debug = FALSE,
callFrom = NULL
)
x |
(character) vector containing digit uunit-prefix and unit terms |
pref |
(character) multiplicative unit-prefixes, assumes as increasing factors of 1000 |
unit |
(character) unit name, the numeric part may be sepatated by one space-character |
sep |
(character) separator characters that may appear between integer numeric value and unit description |
headingTxt |
(character) additional text preceeding the numeric part of 'x' to be ingnored/removed |
silent |
(logical) suppress messages |
debug |
(logical) additional messages for debugging |
callFrom |
(character) allow easier tracking of messages produced |
Please note that the current version recognizes and converts only interger values, decimals or scientific writing won't work.
The resultant numeric vector expresses all values as lowest prefix unit level.
In case of invalid entries NA
s will be returned.
Please note the 'u' is used for 'micro'.
This function returns a numeric vector with quantities extracted and adjusted to a single type of unit (without the unit description)
convToNum
adjustUnitPrefix(c("10.psec abc","2 fsec etc"), unit="sec")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.