formatting: Format Edgeweights (times and distances)

Description Usage Arguments Value Examples

Description

Functions to make the interface easier and more intuitive to use - they convert numeric edgeweights (e.g. 900) to character strings (e.g. "15min"), and vice versa.

Usage

1
2
3
numericEdgeWeight(edgeWeight, type)

prettyEdgeWeight(edgeWeight, type)

Arguments

edgeWeight

A time or distance, in numeric or string form.

type

Either 'time' or 'distance'.

Value

Either a numeric or formatted edgeweight

Examples

1
2
3
4
5
numericEdgeWeight("1hr 30m", "time") # 5400
numericEdgeWeight("1ml", "distance") # 1609

prettyEdgeWeight(1245, "time") # 30min 45s
prettyEdgeWeight(1245, "distance") # 1km 245m

cwthom/TargomoR documentation built on Dec. 24, 2019, 7:02 p.m.