Skip to content

Unit-aware arguments to ors_isochrones() #51

@aoles

Description

@aoles

Leverage the units package for assigning units to variables provided to arguments such as ranges or intervals to e.g. ors_isochrones() and for doing the conversion from hours/minutes to the internal representation in seconds. Based on unit type (time vs. distance) appropriate range_type could be chosen, see also measurements.

library(units)
#> udunits system database from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/units/share/udunits

x <- set_units(20, "min")
x
#> 20 [min]

units(x) <- "secs"
x
#> 1200 [s]

library(measurements)
conv_unit_options$duration
#>  [1] "nsec" "usec" "msec" "sec"  "min"  "hr"   "day"  "wk"   "mon"  "yr"  
#> [11] "dec"  "cen"  "mil"  "Ma"

Created on 2019-05-09 by the reprex package (v0.2.1)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions