Skip to content

Instantly share code, notes, and snippets.

@barryrowlingson
Created December 5, 2014 23:21
Show Gist options
  • Save barryrowlingson/5464bb25fecfe735943b to your computer and use it in GitHub Desktop.
Save barryrowlingson/5464bb25fecfe735943b to your computer and use it in GitHub Desktop.
read some data file..
readit = function(filename){
lines = readLines(filename)
whichdata = grep("^[0-9]{4}",lines)
headers = read.table(textConnection(lines[min(whichdata)-1]))
datalines = lines[whichdata]
dmat = read.table(textConnection(datalines),na.strings=c("***","****"))
names(dmat)=t(headers)[,1]
dmat
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment