Learn R Programming

TargomoR (version 0.2.0)

formatting: Format Edgeweights (times and distances)

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

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

Run this code
# NOT RUN {
numericEdgeWeight("1hr 30m", "time") # 5400
numericEdgeWeight("1ml", "distance") # 1609

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

# }

Run the code above in your browser using DataLab