wideMacroMIDAS: reshapes from long to wide data frame

Description Usage Arguments Value See Also Examples

Description

uses the reshape stats function to reshape 'midas' dataframe from long format to wide format.

Usage

1
2
3
4
wideMacroMIDAS(x, code = "code", 
	datetime = "datetime", 
	vars = c("avg.flow", "avg.flow.per.lane", "avg.spd", "avg.den", "avg.den.per.lane"),...,
	traffic.bound = NULL)

Arguments

x

object of class 'midas'

code

character. name of the code column. codec is the variable in long format that differentiates multiple records (?reshape for more info) Default to "code"

datetime

character. datetime column name. datetimec is names of one or more variables in long format that identify multiple records from the same group/individual. (?reshape for more info) Default to "datetime" (datetimeMIDAS)

vars

character. names of variables in the long format that correspond to multiple variables in the wide format (?reshape for more info) Default to c("avg.flow", "avg.flow.per.lane", "avg.spd", "avg.den", "avg.den.per.lane") (macroMIDAS)

...

optional additional arguments to stats::reshape

traffic.bound

(optional) character. if midas object has only anticlockwise traffic data then set to anticlockwise to order the dataframe from start point to end point (because the code numbers for both directions are the same).

Value

list containing the wide format data frame(s) for each variable in 'vars' argument.

See Also

macroMIDAS, addDescMIDAS, datetimeMIDAS

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
#md is a one .csv data set you've downloaded
ex <- datetimeMIDAS(x = md)
ex <- cutTimeMIDAS(x = ex, start.time = 9, end.time = 10)
ex <- macroMIDAS(x = ex, spd.method = "weighted")
sub.ex <- routeMIDAS(x = ex, road = "M25", traffic.bound = "anticlockwise",
		start.pt = "4909", end.pt = "4860", location.info = c("mainline","onramp"))
mflows <- wideMacroMIDAS(sub.ex, vars = "avg.flow", traffic.bound = "anticlockwise")

## End(Not run)

arwasayegh/mdep documentation built on May 20, 2019, 1:27 p.m.