Skip to content

Instantly share code, notes, and snippets.

@hoffmanc
Created April 27, 2011 17:40
Show Gist options
  • Save hoffmanc/944764 to your computer and use it in GitHub Desktop.
Save hoffmanc/944764 to your computer and use it in GitHub Desktop.
library(foreign)
setwd("\\\\wrjfiler\\wgx\\07183 - UVM TRC\\Signature #2\\data\\rundata\\CarDataREADONLY")
geo_files <- list.files(pattern=".*GEO.csv", recursive=T)
geo_tables <- c()
for(idx in 1:length(geo_files)){
runid <- sub(".*RUN_(\\d+).*", "\\1", geo_files[idx], perl=T)
mode(runid) <- "integer"
table <- read.csv(
geo_files[idx],
sep = ",",
col.names = c("v1", "lat", "latdir", "lon", "londir", "time", "date", "v2", "v3", "v4", "v5", "v6")
)
table$runcnt = runid
geo_tables <- rbind(geo_tables, table)
}
library(plyr)
print(ddply(geo_tables, .(runcnt), summarize, Cnt = length(time)))
print(ddply(geo_tables, .(runcnt), summarize, CntUnique = length(unique(time))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment