Reputation: 1895
I currently have a txt file that contains instructions in the first 10 rows followed by comma separated values. I would like to read this file in R but am not sure how since there are essentially two parts to the file with different structure.
I currently pre-process the file in Python but was wondering if there was a way to avoid this and only do it in R?
sample:
This is a row containing instructions
Here is another one
More instructions
date,dollar_amount,zip_code
2014-10-01,43.33,93210
2014-10-01,42.00,94612
Edit: I wouldn't mind a suggestion on how to do this in Python if doing the whole thing in Python is better.
Upvotes: 0
Views: 135
Reputation: 1647
just do (in R)
read.table("yourfile.txt", skip=10, header=TRUE, sep=",")
where skip indicates how many lines at the start of the file to ignore
Upvotes: 3