Learn R Programming

tidyusmacro (version 0.1.0)

getPCEInflation: Load and Process Personal Consumption Expenditures (PCE) Data

Description

This function loads flat files containing various economic data at the specified frequency and processes them to compute the Personal Consumption Expenditures (PCE) series.

Usage

getPCEInflation(frequency = "M", NIPA_data = NULL)

Value

A tbl_df (data frame) containing the PCE data with calculated variables.

Arguments

frequency

Character string indicating the frequency of the data. Defaults to "M" (monthly).

NIPA_data

Optional data frame. If provided, it will be used as the raw NIPA dataset instead of loading fresh data with getNIPAFiles().'

Details

It performs the following steps:

  1. Loads the full dataset using load_flat_files.

  2. Extracts total GDP data (from table "U20405" and series code "DPCERC").

  3. Computes the PCE weight for each observation as the nominal consumption share (i.e., consumption value divided by total GDP).

  4. Extracts a quantity measure from table "U20403".

  5. Loads the PCE data from table "U20404", joins the computed weights and quantity data, and calculates several period-over-period growth measures.

Examples

Run this code
# \donttest{
  # Load monthly PCE data
  pce_data <- getPCEInflation("M")
# }

Run the code above in your browser using DataLab