download_data_macro_predictors {tidyfinance}R Documentation

Download and Process Macro Predictor Data

Description

Downloads and processes macroeconomic predictor data based on the specified type (monthly, quarterly, or annual), date range, and source URL. The function first checks if the specified type is supported, then downloads the data from the provided URL (defaulting to a Google Sheets export link). It processes the raw data into a structured format, calculating additional financial metrics and filtering by the specified date range.

Usage

download_data_macro_predictors(
  type,
  start_date,
  end_date,
  url = "https://docs.google.com/spreadsheets/d/1g4LOaRj4TvwJr9RIaA_nwrXXWTOy46bP"
)

Arguments

type

The type of dataset to download ("macro_predictors_monthly", "macro_predictors_quarterly", "macro_predictors_annual").

start_date

Optional. A character string or Date object in "YYYY-MM-DD" format specifying the start date for the data. If not provided, the full dataset is returned.

end_date

Optional. A character string or Date object in "YYYY-MM-DD" format specifying the end date for the data. If not provided, the full dataset is returned.

url

The URL from which to download the dataset, with a default Google Sheets export link.

Value

A tibble with processed data, filtered by the specified date range and including financial metrics.

Examples


  macro_predictors_monthly <- download_data_macro_predictors("macro_predictors_monthly")


[Package tidyfinance version 0.3.0 Index]