Read a National Income and Product Accounts data table
Read multiple files with data in rows using
read.transpose and combine the initial columns.
A character vector of names of files from which the data are to be
a single character to identify footnote references in the variable
names in some but not all of
optional arguments for
This is written first and foremost to facilitate updating
USFinanceIndustry from Table 6.16: Income and
employment by industry in the National Income and Product Account
tables published by the Bureau of Economic Analysis of the United
States Department of Commerce. As of February 2013, this table can be
obtained from http://www.bea.gov: Under "U.S. Economic
Accounts", first select "Corporate Profits" under "National". Then
next to "Interactive Tables", select, "National Income and Product
Accounts Tables". From there, select "Begin using the data...".
Under "Section 6 - income and employment by industry", select each of
the tables starting "Table 6.16". As of February 2013, there were 4
such tables available: Table 6.16A, 6.16B, 6.16C and 6.16D. Each of
the last three are available in annual and quarterly summaries. The
USFinanceIndustry data combined the first 4 rows of
the 4 annual summary tables.
This is available in 4 separate files, which must be downloaded and
readNIPA. The first three of these are
historical data and are rarely revised. For convenience and for
testing, they are provided in the
demoFiles subdirectory of
It has not been tested on other data but should work for annual data with a sufficiently similar structure.
The algorithm proceeds as follows:
1. Data <- lapply(files, read.transpose)
Data a list of numeric matrices? If no, print an
3. cbind common initial variables, averaging overlapping years, reporting percent difference
4. attributes: stats from files and overlap. Stats include the first and last year and the last revision date for each file, plus the number of years overlap with the previous file and the relative change in the common files kept between those two files.
matrix of the common variables
1 2 3 4 5 6
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.