Relative Content

Tag Archive for rdataframetxt

Converting a large text file with inconsistencies into a data frame in R

I have a very large text file with tens of thousands of rows and around a hundred columns. The columns in the text file are stored based on character position. 1-20 is column1, 21-59 is column2, etc. Each row is around 1800 individual characters long. My current code is working how I want it to for about the first 70,000 rows. However, this particular file has some random rows that do not follow the pattern. These lines throw off the program and it doesn’t read the rest of the lines. All the regular rows start with a 12 digit long identification number while the bad rows look like this.