I am trying to read a text file (https://www.bls.gov/bdm/us_age_naics_00_table5.txt) into R
, but I am not sure how to go about parsing it. As you can see, the column names (years) are not located all on the same row, and the space between data is not consistent from column to column. I am familiar with using read.csv()
and read.delim()
, but I'm not sure how to go about reading a complex file like this one.
How to read a text file whose variables are not stored on the same row, and that lacks a standard delimiter from column to column, into R?
37 Views Asked by Anthony Colavito At
1
Here is a manual parse:
If you then want to recode "_" as
NA
, and format the numbers: