Functions to parse character vectors into quantities.
Usageparse_quantities(x, decimal_mark)
parse_units(x, decimal_mark)
parse_errors(x, decimal_mark)
Arguments
a character vector to parse.
the dot (.
) if not provided.
A quantities
, units
or errors
object respectively.
Each parse_*()
function returns an object of the corresponding type, no matter what it is found. This means that, for parse_units
, if errors are found, they are dropped with a warning. Similarly for parse_errors
, if units are found, they are dropped with a warning. On the other hand, parse_quantities
always returns a valid quantities
object, even if no errors or units are found (then, zero error and dimensionless units are applied).
parse_quantities("(1.6021766208 +/- .0000000098) e-19 C")
#> 1.60217662(1)e-19 [C]
parse_quantities("1.6021766208(98) e-19 C")
#> 1.60217662(1)e-19 [C]
parse_units("1.6021766208 e-19 C")
#> 1.602177e-19 [C]
parse_errors("1.6021766208(98) e-19")
#> 1.60217662(1)e-19
# quantities are converted to the first unit
parse_quantities(c("12.34(2) m/s", "36.5(1) km/h"))
#> Units: [m/s]
#> Errors: 0.02000000 0.02777778
#> [1] 12.34000 10.13889
# or kept as a list of mixed units
parse_quantities(c("1.02(5) g", "2.51(0.01) V", "(3.23 +/- 0.12) m"))
#> Mixed units: V (1), g (1), m (1)
#> 1.02(5) [g], 2.51(1) [V], 3.2(1) [m]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4