Description Usage Arguments Details Value Examples
The BLS Multi-screen data tool http://www.bls.gov/data/#employment can
return a tab-seperated file to the web page which you then cut and paste
as a .tsv using some text editor. The file needs some cleaning up. While
this is pretty simple in the text editor, this function does all that is
needed and writes out a new .tsv which imports nicely with read_tsv()
.
1 | BLS_CleanRawTextFile(fin, fout = NA, append = "_Clean")
|
fin |
The path/name if not in home directory |
fout |
If present, a file path/name for cleaned file. If omitted, fin
is used with |
append |
A String to append to the string |
These cleanups are done: 1) If first line is "Original Data Value", it is removed; 2) First line should now be field names starting with "Series ID". Error is thrown if it isn't; 3) Spaces in field names are replaced with underscores; 4) Numeric values may have "(C)" or "(P)" suffix to flag value as corrected or preliminary respectively; 5) When either "(C)" or "(P)" are present, a legend is appended to the data file. These lines are removed. 6) Any empty lines at end of file are removed.
The cleaned .tsv file is written with append
appended to file name.
The path/name of the cleaned file if succussful else an empty string.
1 2 3 4 | ## Not run:
BLS_CleanRawTextFile("data/BLS_NonFarmEmploymentInAreasAL_2015.tsv")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.