emme2 {emme2}R Documentation

Read and Write to an EMME/2 databank

Description

This package includes functions to read and write to an EMME/2 databank.

Usage

read.file0(bank)
read.file1(bank, file0)
read.matdir(bank, file0, mmat)
read.ms(bank, file0) 
read.mo(numname, bank, file0, mcent, mat.dir)
read.md(numname, bank, file0, mcent, mat.dir) 
read.mf(numname, bank, file0, mcent, mat.dir) 
write.mf(data, numname, bank, file0, mcent, mmat, mat.dir, newname=NULL, newdesc=NULL)
read.link.data(bank, scen.num, file0, mscen, mlink, mnode)
read.nodes(bank, scen.num, file0, mscen, mlink, mnode) 
plotLinks(link.data, nodes, centroids=F, ...)
ftnode(node.data, outgoing.links, jnode, mlink)

Arguments

bank String of the EMME/2 databank file name
file0 Databank metadata data frame
mmat Maximum number of matrices
numname mf number or name as a string to read in or write to
newname new name of the matrix to write out
newdesc new description of the matrix to write out
mcent Maximum number of centroids
mat.dir matrix directory object
data either a vector or matrix of data to write to bank
scen.num scenario number to read from (in EMME/2 order - not named number)
mscen Maximum number of scenarios
mlink Maximum number of links
mnode maximum number of nodes
link.data EMME/2 link data.frame
nodes EMME/2 nodes data.frame
centroids T/F, Should the centroids be plotted?
node.data EMME/2 nodes data.frame
outgoing.links EMME/2 internal file 9 vector from read.link.data
jnode EMME/2 internal file 11 vector from read.link.data
... graphical parameters can be given as arguments to plot

Details

For details about the EMME/2 internal file structure refer to Appendix C of the EMME/2 User's Manual

Value

read.file0 data.frame EMME/2 internal file offsets
read.file1 list EMME/2 global and scenario parameters
read.matdir data.frame EMME/2 matrix directory
read.ms vector EMME/2 all ms values
read.mo vector EMME/2 mo values
read.md vector EMME/2 md values
read.mf matrix EMME/2 mf values
write.mf NA Nothing returned
read.link.data list EMME/2 link data
read.nodes data.frame EMME/2 node data
plotLinks NA Plots EMME/2 network
ftnode named numeric EMME/2 link data in from to node format

Author(s)

Ben Stabler <benjamin.stabler@odot.state.or.us>
http://www.odot.state.or.us/tddtpau/R.html

Examples

## Don't run: 
# Function call to create databank offset file0
file0 <- read.file0("emme2\\emme2ban")

#Function call to create file1 info (global parameters)
file1 <- read.file1("emme2\\emme2ban", file0)

#Function call to read matrix directory
mat.dir <- read.matdir("emme2\\emme2ban", file0, file1$global["mmat"])

#Function call to read all ms from databank
ms <- read.ms("emme2\\emme2ban", file0)

#Function call to read mo2
mo2 <- read.mo(2, "emme2\\emme2ban", file0, file1$global["mcent"], mat.dir)

#Function call to read md2
md2 <- read.md(2, "emme2\\emme2ban", file0, file1$global["mcent"], mat.dir)

#Function call to read mf2
mf2 <- read.mf(2, "emme2\\emme2ban", file0, file1$global["mcent"], mat.dir)

#Function call to read mf "opskim"
mf2 <- read.mf("opskim", "emme2\\emme2ban", file0, file1$global["mcent"], mat.dir)

#Function call to write mf2
x <- rnorm(mf2) #Random generate length(mf) numbers to write dummy data to bank
write.mf(x, 2, "emme2\\emme2ban", file0, file1$global["mcent"], file1$global["mmat"], mat.dir, newname="test", newdesc="test matrix")

#Function call to read link data
link.data <- read.link.data("emme2\\emme2ban", 1, file0, file1$global["mscen"], file1$global["mlink"], file1$global["mnode"])

#Function call to create from to node link table
tofrom <- ftnode(link.data[[1]], link.data[[2]], link.data[[3]], file1$global["mlink"])

#Function call to create node table
nodes <- read.nodes("emme2\\emme2ban", 1, file0, file1$global["mscen"], file1$global["mlink"], file1$global["mnode"])

#Function call to plot network
plotLinks(link.data, nodes, centroids=F, col="black")
## End Don't run

[Package Contents]