Anthony Damico
2012-Feb-07 16:45 UTC
[R] Reading a Fixed-Width File with SAS import instructions directly into an R data frame
Hi everyone, I'm wondering if anyone has written (or knows of) an R function that takes the SAS import code to read in an ASCII / fixed-width data file.. and then parses out the SAS code to figure out how to structure a (foreign package) read.fwf command so that fixed-width data file can be read directly into an R data frame? I'm envisioning a function that returns an R data frame from ASCII data set, using two parameters: the location of the ASCII data and the location of the SAS import code. I have done some work on the topic (https://gist.github.com/1253937), but it's got a lot of bugs. Before I spend a bunch of time cleaning this up, I wanted to check that I'm not re-inventing the wheel. Any leads on related (and probably much further along) work would be appreciated. Thanks!! [[alternative HTML version deleted]]