-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
323 additions
and
389 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
.Rhistory | ||
.RData | ||
tcadr.Rproj | ||
*.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Sample .travis.yml for R projects. | ||
# | ||
# See the r-travis repo and its wiki | ||
# https://github.com/craigcitro/r-travis/ | ||
# https://github.com/eddelbuettel/r-travis/ | ||
|
||
language: c | ||
|
||
sudo: required | ||
|
||
before_install: | ||
## r-travis by Craig Citro et al | ||
- curl -OL http://raw.github.com/craigcitro/r-travis/master/scripts/travis-tool.sh | ||
- chmod 755 ./travis-tool.sh | ||
- ./travis-tool.sh bootstrap | ||
|
||
install: | ||
- ./travis-tool.sh install_aptget r-cran-rcpp r-cran-runit | ||
|
||
script: | ||
- ./travis-tool.sh run_tests | ||
|
||
after_failure: | ||
- ./travis-tool.sh dump_logs | ||
|
||
notifications: | ||
email: | ||
on_success: change | ||
on_failure: change |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
Package: tcadr | ||
Type: Package | ||
Title: Import TransCAD Objects to R | ||
Version: 0.0.2.2 | ||
Date: 2015-09-25 | ||
Version: 0.2.1 | ||
Date: 2016-02-29 | ||
Authors@R: c( | ||
person("Gregory", "Macfarlane", email = "[email protected]", role = c("aut", "cre")), | ||
person("Amar", "Sarvepalli", email = "[email protected]", role = c("aut")) | ||
) | ||
Description: Caliper's TransCAD application and GISDK language are widely used | ||
in travel demand modeling applications. However, it can be difficult to conduct | ||
complex analyses with these tools, because the file formats are unique and/or | ||
non-standard. This package contains helper scripts to read TransCAD files for use | ||
in R. | ||
non-standard. This package contains helper scripts to read TransCAD files for | ||
use in R. | ||
License: MIT + file LICENSE | ||
LazyData: TRUE | ||
LinkingTo: Rcpp | ||
Imports: Rcpp, dplyr, data.table | ||
Imports: | ||
Rcpp, | ||
dplyr, | ||
data.table | ||
RoxygenNote: 5.0.1 | ||
Suggests: | ||
testthat | ||
Depends: | ||
R (>= 3.2.2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#' Read in TransCAD assignment file | ||
#' | ||
#' @description TransCAD returns fairly uniform assignment results containing | ||
#' times, speeds, volumes, etc. by direction. This function returns the flow | ||
#' information as a tidy data frame | ||
#' | ||
#' @param file Path to assignment binary file. | ||
#' @param field The name of the field to collect; if \code{NULL} (default), then | ||
#' will return all fields. | ||
#' | ||
#' @import dplyr tidyr | ||
#' | ||
#' @export | ||
#' | ||
read_assignment <- function(file, field = NULL){ | ||
a <- read_tcad(file) %>% | ||
rename(linkid = ID1) | ||
|
||
# select chosen fields if any | ||
if(!is.null(field)){ | ||
a <- select(a, linkid, matches(field)) | ||
} | ||
|
||
a %>% | ||
gather(field, value, -linkid) %>% | ||
separate(field, c("dir", "field"), extra = "merge") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
#' @title Write a TransCAD binary file | ||
#' Write a TransCAD binary file | ||
#' | ||
#' @description Write a TransCAD \code{.bin} binary data file fromt the workspace. | ||
#' @description Write a TransCAD \code{.bin} binary data file from the workspace. | ||
#' | ||
#' @param df workspace dataframe object | ||
#' | ||
#' @param file_name The path and name of the binary data file, e.g. | ||
#' @param file The path and name of the binary data file, e.g. | ||
#' \code{data/foo.bin}. | ||
#' | ||
#' @details If any factors exist in the data frame, then those fields are writern | ||
#' out with factor level (instead of actualvalue). Remove dataframe factors. | ||
#' @details This version doesn't work well with NA's in the dataframe. | ||
#' | ||
#' @return The \code{DCB} dictionary file will be writern to the same | ||
#' folder. Prints dcb file contents to console.Need to make it a user defined | ||
#' option. | ||
#' @return The \code{DCB} dictionary file will be written to the same | ||
#' folder as the \code{.bin} file. | ||
#' | ||
write_bin <- function(df,file_name){ | ||
typs <- sapply(df,typeof) | ||
write_df_to_binary(df,file_name,typs) | ||
write_tcad <- function(df, file){ | ||
|
||
i <- sapply(df, is.factor) # which variables are factors? | ||
df[i] <- lapply(df[i], as.character) # convert them to char strings | ||
|
||
typs <- sapply(df, typeof) | ||
write_df_to_binary(df, path.expand(file), typs) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.