unit.from.string | R Documentation |
This function will try its best to interpret strings like "liter/(nmol ms)" rules: 1. only one slash is allowed 2. M can be mega or mol/l: writing M for molarity will treat molarity as it's own unit kind; writing "molarity" will be translated into two SI units (mol and litre) 3. prefixes and units can be words or single letters 4. everything after a slash is the denominator 5. u is an accepted replacement for μ (unicode greek mu or unicode micro symbol) 6. no parentheses (ignored): "(m/s)*kg" will be misinterpreted
unit.from.string(unit.str)
unit.str |
a string that contains a human readable unit |
verbose |
if TRUE, this function prints what it does (to find problems) |
this retruns a data.frame with components as in the sbml standard: kind, multiplier, scale and exponent since there is only one slash,parentheses do nothing everything after a slash is the denominator, so: l/mol s is the same as (l)/(mol s) Remark: not all units are understood.
data.frame with an interpretation of the unit (multiplier is unused here, but may be used later to deal with units such as hours (kind=second, multiplier=60)
> unit.from.string("m/s")
scale multiplier exponent kind
1 0 1 1 metre
2 0 1 -1 second
> unit.from.string("micromolarity")
scale multiplier exponent kind
1 -6 1 1 mole
2 0 1 -1 litre
> unit.from.string("µM")
scale multiplier exponent kind
1 -6 1 1 molarity
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.