Skip to content

Instantly share code, notes, and snippets.

@black-tea
Last active January 6, 2016 23:01
Show Gist options
  • Save black-tea/f73a9571802cc9723f74 to your computer and use it in GitHub Desktop.
Save black-tea/f73a9571802cc9723f74 to your computer and use it in GitHub Desktop.
library(data.table)
### Inputs ###
meta.file <- "Z:/GIS/DataLibrary/Riits/TrafficVolumes/data dump/EXPORT - 2015/config.dsv"
### Load Data ###
meta.df <- fread(meta.file, header=T,sep="|",stringsAsFactors=F)
### Clean XY Data ###
x <- gsub('.+\\((-[0-9]+\\.[0-9]+) {1}([0-9]+\\.[0-9]+).+','\\1',meta.df$START_LAT_LONG)
y <- gsub('.+\\((-[0-9]+\\.[0-9]+) {1}([0-9]+\\.[0-9]+).+','\\2',meta.df$START_LAT_LONG)
meta.df$START_LAT_LONG <- NULL
meta.df <- cbind(meta.df,x,y)
### Export to CSV ###
write.table(meta.df,file="Z:/GIS/DataLibrary/Riits/TrafficVolumes/data dump/EXPORT - 2015/config-CLEAN.csv",sep=",",row.names=FALSE)
@black-tea
Copy link
Author

modified for space instead of comma btw coords

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment