I have the source code from a program that I want to convert to DataFrame. The text file is not formatted and as shown below.
10037 149439Special Event 11538.00 13542.59 2004.59
10070 10071Weekday 8234.00 9244.87 1010.87
10216 13463Weekend 145.00 0 -145.00
I can read the data in Rusing readLines()in the base package. How can I convert this to data that looks like this (column names can be any).
A B C D E F
10037 149439 Special Event 11538.00 13542.59 2004.59
10070 10071 Weekday 8234.00 9244.87 1010.87
10216 13463 Weekend 145.00 0 -145.00
What regular expression should be used to achieve this? I know this is perfect for combining regexec()and regmatches(). But I canβt come up with an expression that breaks the line into the right components.
source
share