Last active
October 6, 2015 20:03
-
-
Save brews/614d5881b8039d8276b6 to your computer and use it in GitHub Desktop.
Combine multiple FHX files for Ellis.
This file contains hidden or 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
#! /usr/bin/env Rscript | |
# 2015-02-25 S. B. Malevich | |
# Combine all FHX files in the current working directory and try to output it | |
# as a single FHX file (`OUTFILE`). You need to have "firehistory.R" in the | |
# same directory, too. | |
ARGS <- commandArgs(TRUE) | |
source("firehistory.R") | |
OUTFILE <- "bigfile.fhx" | |
targets <- Sys.glob("*.fhx") | |
blob.fhx <- read.fhx(targets[1]) | |
stopifnot(length(targets) >= 2) # In case only 1 FHX file in directory. | |
for (i in seq(2, length(targets))) { | |
t <- targets[i] | |
print(paste(Sys.time(), "Working on file:", t)) # DEBUG | |
victim.fhx <- read.fhx(t) | |
blob.fhx <- blob.fhx + victim.fhx | |
} | |
write.fhx(blob.fhx, fname = OUTFILE) | |
q(status = 0, save = 'no') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment