Common Data Analysis Pattern with a Simple Solution in R

08-05-2019  0 Comment(s)

It seems that much of the data analysis work I've done over the last few months has followed a "script". First, identify data, often government-sponsored and freely-available, that's of keen interest. Next, find the websites that house the data and download the relevant files to my notebook. The downloads might ultimately be one-off or included in the data analysis programs. Finally, load the data into either R or python and have at it with queries, visualizations, and statistical/learning models.

Several examples of recent work come to mind. The first involves data from the Bureau of Labor Statistics on jobs and educational attainment from 1992-2017. On this site, 24 spreadsheets are Available detailing monthly statistics on six measures of employment by 4 levels of educational attainment. For a previous blog, I downloaded 12 of these files, including measurements laborforce, employed, and unemployed by educational levels no HS, HS grad, some college, and college grad. I renamed the spreadsheets on my SSD to include indicators of dimension -- eg "clf_laborforce_collegegrad.xls".

The second example, the topic of this blog, has to do with Medicare charges summarized by hospital and diagnostic related grou... At this point there are five files (either csv or spreadsheet) available for download, representing the years 2011-2015. Year is embedded in the website file names.

A third illustration, and the topic of a coming blog, revolves on census data from the American Community Survey.

The pattern behind the three cases includes:

  1. readily downloadable files, generally either csv or xls. These files can either be copied by hand or moved programmatically.
  2. multiple of these files, often dimensioned by time or other variable(s).
  3. a common, consistent format to the files, so that "reads" will work similarly on each.
  4. a structured file naming convention, either given or assigned, that provides dimensional info for data loads. Date/Time is the most common diemnsion.

Comment Here


No Comments to Show