as.unit | R Documentation |
This converts strings to unit objects. It is designed mainly for
use within various functions in the package, not for the end user.
Therefore, the documentation does not give a full listing; for that,
developers should examine the tests/test_that/test_units.R
file.
Developers who wish to add new entries are asked to follow
the conventions in this file, with regard to regular expressions,
spaces between tokens, etc., and also to add tests for whatever
they add.
as.unit(u, default = list(unit = expression(), scale = ""))
u |
a character string indicating a unit. Case is ignored, so that e.g.
|
default |
a default to be used for the return value, if |
if as.unit
recognizes u
as unit, then it returns a list
with elements unit
, which is an expression()
, and scale
,
which is a character value. That is also the case if it does
not recognize u
, and if default
is not specified. However,
if u
is not recognized, and if default
is provided by the user,
then as.unit
returns the provided value of default
.
Dan Kelley
as.unit("DBAR")
as.unit("IPTS-68")
as.unit("ITS-90")
as.unit("PSS-78")
as.unit("UMOL/KG")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.