README.md

ecoMoon: Quickly download, transform, and visualize economic data

This package is an all inclusive economic package allowing for economic data to be easily and quickly downloaded, transformed, and visualized. Reporting and modeling capabilities coming soon as well as additional data sources.

Installation

This package is currently only available from GitHub.

devtools::install_github("soloemoon/ecoMoon")

Functions Overview

Download Economic Data

Economic data can be downloaded using the eco.download function. This function allows for data to be extracted from a specified source (currently only FRED and BLS are supported...more coming soon). Options allow for the inclusion of recession data, time series (xts) output, and output in either the long or wide format. Quarters and years are automatically added to each dataset making slicing and grouping incredibly easy. The entire history of the dataset is pulled using this function.

Source can be 'fred' or 'bls'. Multiple keys can be passed at a time.

test_data <-eco.download(source= 'fred', keys = c('UNRATE', 'PAYEMS'),show.recession = 'y', periodicty = 'monthly', shape='wide', show.recession='y')

Dictionary: * keys - Value identifiers * FRED API values can be found at https://fred.stlouisfed.org/releases * BLS API values have been cleaned for ease of use: ``` labor_force = 'LNS11000000', employment = 'LNS12000000', unemployment = 'LNS13000000', unemployment_rate = 'LNS14000000', nonfarm_employment = 'CES0000000001', avg_weekly_hrs = 'CES0500000002', avg_weekly_hrs_nonsup = 'CES0500000007', avg_hrly_earnings = 'CES0500000003', avg_hrly_earnings_nonsup = 'CES0500000008', nonfarm_productivity = 'PRS85006092', nonfarm_labor_costs = 'PRS85006112', nonfarm_hrly_compensation = 'PRS85006152', nonfarm_multi_productivity = ' MPU4910012', cpi_urban_80s = 'CUUR0000SA0', cpi_urban_67 = 'CUUR0000AA0', core_cpi_u = 'CUUR0000SA0L1E', core_cpi_w = 'CWUR0000SA0L1E', ppi_final_sa = 'WPSFD4', ppi_final_ua = 'WPUFD4', ppi_final_core = 'WPUFD49104', ppi_final_core_less_trade = 'WPUFD49116', ppi_finshed_goods_82 = 'WPUFD49207', imports_all_commodities = 'EIUIR', exports_all_commodities = 'EIUIQ', employment_cost_index = 'CIU1010000000000A', eci_private = 'CIU2010000000000A', eci_private_wages = 'CIU2020000000000A'

``` * shape - specifies if the dataframe should be outputted in the long (keys in rows) or the wide (keys in columns) format. The default is wide. * show.recession - determines whether to include or exclude recession indicators (only available for monthly, daily, or quarterly data). Weekly transformation coming soon. Default is to include recession indicator. * time.series - determines whether the output of the data will be a dataframe or xts object. Default is 'n' meaning data is outputted as dataframe. * periodicity - dictates over what time period the recession indicator is for. Default is monthly. Options include monthly, quarterly, and daily. Weekly periodicity coming soon. It is suggested that only data reflecting the same periodicity be downloaded in a single call.

Transform Economic Data

Transformations can be applied to an entire economic dataset using the eco.transform function.

# Download data to be transformed

data <-eco.download(source='fred', keys = c('UNRATE', 'PAYEMS'), shape = 'w', show.recession = 'y',time.series = 'n', periodicity = 'monthly') 

# Transform data set
data.trans <-eco.transform(df = data, transformation = '% change', lags = 1)

Dictionary:

Plotting Tools

Clean pre-formatted plots have been included. If the data set being plotted has recession bars present, the plots automatically display recession bars. Plots are based on GGPlot2 and GGTheme.

data <-eco.download(source = 'fred', keys = c('UNRATE', 'PAYEMS'), shape = 'w', show.recession = 'y',time.series = 'n', periodicity = 'monthly') 

eco.plot(plot_type = 'line', df = data, x='date', y = 'Payrolls', y.title = 'Chg', title = 'NFP Change', caption = 'Source: Bureau of Labor Statistics', date.break = '5 year')

Included plot types are: * single line - plot a single economic data series (line chart) * dual line - plot two economic series (linechart) * tri line - plot three economic series (line chart) * bar - plot economic series as a bar * bar line - plot two economic series: one as a line and the other as a bar.

Each plot includes options to adjust the color, titles, caption, subtitle, legend position, date format, line size, and text size.

image

image

Thanks to all the developers of packages such as dplyr, purrr, fredr, etc whose hard work made this package possible!



soloemoon/ecoMoon documentation built on Oct. 7, 2022, 9:59 a.m.