Type: | Package |
Title: | Convert Between Units |
Version: | 0.1 |
Date: | 2015-06-24 |
Description: | Provides conversion functionality between a broad range of scientific, historical, and industrial unit types. |
Depends: | R (≥ 3.1.0) |
Imports: | shiny(≥ 0.13.2), miniUI(≥ 0.1.1), DT(≥ 0.1), rstudioapi(≥ 0.5) |
License: | MIT + file LICENSE |
LazyData: | TRUE |
BugReports: | https://github.com/GShotwell/convertr/issues |
Suggests: | testthat |
RoxygenNote: | 5.0.1 |
NeedsCompilation: | no |
Packaged: | 2016-10-12 18:17:56 UTC; Shotwell |
Author: | Gordon Shotwell [aut, cre] |
Maintainer: | Gordon Shotwell <g.e.shotwell@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2016-10-13 20:37:00 |
convertr
Description
convertr allows you to convert numeric vectors between various unit types.
Conversion factors for various units
Description
This table provides the conversion factors for convert
.
The conversion factor is broken into four componts: A, B, C, and D. Units are
converted from the origin unit (X) to the respective SI base unit (BU)
using the following formula:
BU = (A + B*X) / (C + D*X)
The data orginates from the POSC Units of Measure Dictionary v2.2 and Wikipedia
Usage
conversion_table
Format
A data frame with 1511 rows and 11 variables:
name: Name of the origin unit
quantity_type: Description of what the unit is used to measure
catalog_name: Origin of unit specification
catelog_symbol: Symbol for the unit
rp66_symbol: Recomended Practice 66 unit
base_unit: Equivalent System Internationale (SI) base unit
a: Conversion factor
b: Conversion factor
c: Conversion factor
d: Conversion factor
multi_unit: Can the unit be converted to other units?
Convert from one unit type to another
Description
Converts numeric vectors from one unit to another Approximately 1500 units
are available.
convert_gadget
can help you build valid convert()
expressions and
explore_units
provides an interface for exploring the conversion_table
which underlies the computation.
Usage
convert(vector, origin, target)
Arguments
vector |
A numeric vector to be converted |
origin |
The catalog symbol of the current unit. |
target |
The catalog symbol of unit you want to convert to. |
Value
A numeric vector
Examples
convert(1:20, "kg", "g")
convert(1:20, "galUK/min.ft2", "kft/s")
## Not run:
convert(1:20, "kg", "km2")
## End(Not run)
Launch interactive conversion gadget
Description
It's often difficult to remember the symbol for the units you
want to convert.This gadget shows which units can be converted to one anohter,
and provides an example calculation on a sample vector
On exit you can either return a valid convert()
call or a
converted numeric vector.
Usage
convert_gadget(vector, return_value = FALSE)
Arguments
vector |
A numeric vector to convert. You can change the vector within the app. |
return_value |
By default the gadget generates a |
Value
Insert output text into editor.
Examples
## Not run:
convert_gadget()
convert_gadget(mtcars$mpg)
## End(Not run)
Explore conversion table
Description
A shiny application that lets you take a look at the
conversion_table
dataframe.
Usage
explore_units()
Value
Launches a Shiny app
Examples
## Not run:
explot_units()
## End(Not run)
Return the conversion table
Description
A convenience function to return conversion_table
Usage
get_conversion_table()
Value
Conversion table dataframe
Examples
a <- get_conversion_table()