Tidy Finance Helper Functions
Overview
Helper functions for empirical research in financial economics, addressing a variety of topics covered in Scheuch, Voigt, and Weiss (2023) doi:10.1201/b23237. The package is designed to provide shortcuts for issues extensively discussed in the book, facilitating easier application of its concepts. For more information and resources related to the book, visit https://www.tidy-finance.org/index.html.
Breaking changes
download_factor_library_ids()anddownload_data("Tidy Finance", "factor_library")read the new layout of the factor library on Hugging Face, where the returns hold onlyid,date, andretin files of 1,000 consecutive IDs named after their range. Only the files that hold the requested IDs are downloaded, and the file listing of the dataset is no longer queried. The result no longer has aret_typecolumn; the weighting scheme is in theweighting_schemecolumn of the grid. Earlier versions of the package cannot read the new layout.- The factor library now builds on the signals of Open Source Asset Pricing, so sorting variables carry their names, e.g.
"size"instead of"me"and"high52"instead of"52w". The examples and the documented grid values follow the new release, which adds the"1m"lag and"capped VW"weighting.
Show all changes in 0.9.0Hide the rest of the changes in 0.9.0
New features
download_data_constituents()gains apathargument that reads an iShares or BlackRock holdings CSV saved from the fund's web page instead of downloading it, e.g.download_data("Index Constituents", path = "holdings.csv").indexis optional withpath. Use it as a fallback when the provider moves its files (#311).- Added
download_data_fred_md()and the"FRED-MD"/"FRED-QD"datasets fordownload_data("FRED", ...), which download the McCracken and Ng (2016, 2021) curated monthly / quarterly macro panels as wide tables (one column per series).transform = TRUEapplies each series' stationarity transform code (tcode).vintageselects the current release (default), a specific"YYYY-MM"release, or"all"- the full real-time panel across every archived vintage (recent vintages are hosted individually; older ones are read from the St. Louis Fed vintage archive ZIPs), enabling leak-free point-in-time analysis.
Bug fixes
download_data_constituents()works again for DAX, EURO STOXX 50, Dow Jones Industrial Average, S&P 500, Nasdaq 100, FTSE 100, MSCI World, STOXX Europe 600, MDAX, TecDAX, MSCI Emerging Markets, and MSCI Europe. iShares removed the German retail pages the holdings files were downloaded from; they are now read from the Swiss professional pages. The header row of a holdings file is detected automatically instead of skipping a fixed number of rows, and a failed download now names the index and the URL and points topath(#311).download_factor_library_grid()caches the grid of the factor library for the rest of the session, sodownload_factor_library_ids()anddownload_data("Tidy Finance", "factor_library", ...)no longer download the grid of more than four million rows on every call (previously twice perdownload_data()call when filtering). Userefresh = TRUEto download it again.- Passing a legacy identifier such as
"factors_ff_3_monthly"asdatasetnow warns that this value is deprecated and names the dataset that replaces it, e.g."Fama/French 3 Factors". The warning previously claimed that thetypeargument was used, although the caller never passed it. estimate_fama_macbeth()now orders the cross-sections chronologically before aggregating them over time. Newey-West standard errors depend on the order of the time series, so the same data in a different row order previously returned different standard errors and t-statistics while the risk premia were unchanged. Results for chronologically sorted input are unaffected (#302).- The documentation of
estimate_fama_macbeth(detail = TRUE)now lists theadj_r_squaredcolumn, which the function has always returned insummary_statisticsalongsider_squaredandn_obs. download_data_stock_prices()now derives dates from the exchange time zone reported by Yahoo Finance instead of converting the timestamps in UTC. Timestamps refer to the market open in local time, so for exchanges ahead of UTC (e.g."^AXJO","^NZ50") every observation was previously dated one calendar day too early and could fall on a weekend.download_data_stock_prices()now returns a range that is inclusive of bothstart_dateandend_datefor every exchange, matching the otherdownload_data_*()functions. The range was previously delegated to Yahoo Finance'speriod1/period2, which are resolved in the exchange's local time zone, soend_datewas excluded for markets at or behind UTC but included for markets ahead of it.download_factor_library_grid(), and with itdownload_data("Tidy Finance", "factor_library"), now readsportfolio_sort_grid.parquetby name instead of every Parquet file listed in the grid repo, which also holds one slice of the grid per sorting variable and the list of sorting variables. Reading the listing failed as soon as the repo held more than one Parquet file.download_factor_library_ids(), and with itdownload_data("Tidy Finance", "factor_library"), no longer fails with "HTTP 404 Not Found" for IDs in a range of 1,000 IDs for which the factor library has no file because none of its portfolio sorts produced portfolios (e.g., IDs 833001 to 835000, which hold"rdcap"sorts withmin_size_quantile = 0.2). Requested IDs without returns are absent from the result, as documented, and a warning now lists them; if none of the requested IDs has returns, the result is an empty tibble with all columns.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-04
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-06-09
- ERROR12 OK, 1 ERROR2026-06-08
- OK14 OK2026-03-27
Show 2 earlier changesHide 2 earlier changes
- ERROR13 OK, 1 ERROR2026-03-25
- OK14 OK2026-03-10
Documentation
- Help pages
- 62 (1 internal)includes a package overview page
- Examples that run
- 47%25 run in a plain check · 14 only when donttest examples are enabled (R CMD check --as-cran) · 13 never run · 1 hold no code
- Exported functions with examples
- 100%
- Documented parameters
- 99%
- Return-value docs
- 100%
- Help pages citing references
- 18%
Downloads
Repository
- PRs merged (all time)
- 95%
- Median days to close, 50 most recently updated closed issues
- 1
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
Commits over time
Commit identities over time
11 development-tooling and community-health practices detected across 6 families in the upstream repository
Checks run against github.com/tidy-finance/r-tidyfinance on 2026-10-22.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-10-21 · The repository has a site deploy workflow
pkgdown site last built 2026-10-21
Show all practicesHide 2 practices
This repository shows signs of AI coding tools.
- GitHub Copilotfirst seen 2026-03-20Pull request: opened by its own accountCommits: 7 by its own account
- Claude Codefirst seen 2026-03-25Seen in the repository: CLAUDE.mdNamed in .Rbuildignore: .claude, CLAUDE.mdNamed in .gitignore: .claude, .claude/skillsPull request it wrote: opened by a project memberCommits: 29 by its own account · at least 106 crediting it in the message
- Claude Opus 5.530 commits · Oct 2026
- Claude Opus 4.821 commits · May to Jun 2026
- Claude Opus 515 commits · Jul to Oct 2026
- Claude Opus 4.714 commits · May 2026
- Claude Sonnet 4.69 commits · Mar to Apr 2026
3 more models not listed. Some of these counts are a minimum, because the search stopped before the oldest commits.
Dependencies
Code & Tests
People & History
Pick two releases to compare their code metrics.
- 0.9.0Latest
- 0.8.02026-06-25 · diff ↗ ·
removed 1 export
validate_datesadded 4 exports
download_data_jkp, download_data_pastor_stambaugh, download_data_stambaugh_yuan, list_supported_jkp_factors - 0.7.02026-06-25 · diff ↗
- 0.6.02026-05-31 · diff ↗ ·
removed 1 export
create_wrds_dummy_databaseadded 6 exports
download_data_pseudo_ccm_links, download_data_pseudo_compustat, download_data_pseudo_crsp, download_factor_library_grid, download_factor_library_ids, list_supported_datasets - 0.5.02026-05-12 · diff ↗ ·
removed 4 exports
add_lag_columns, disconnection_connection, download_data_factors, lag_columnadded 12 exports
add_lagged_columns, compute_rolling_value, disconnect_connection, download_data_huggingface, download_data_risk_free, filter_options, filter_sorting_data, get_available_huggingface_files, implement_portfolio_sort, join_lagged_values, portfolio_sort_options, validate_dates - RR 4.6.0 released · 2026-04-24
- 0.4.52026-01-08 · diff ↗
- 0.4.42025-05-07 · diff ↗
- RR 4.5.0 released · 2025-04-11
- 0.4.32024-12-17 · diff ↗
- 0.4.2
- 0.4.12024-09-04 · diff ↗ ·
removed 1 export
download_data_wrds_clean_traceadded 1 export
download_data_wrds_trace_enhanced - 0.4.02024-08-30 · diff ↗ ·
removed 2 exports
download_data_stocks, download_data_stocks_yfadded 13 exports
breakpoint_options, compute_breakpoints, compute_long_short_returns, compute_portfolio_returns, data_options, download_data_constituents, download_data_fred, download_data_osap, download_data_stock_prices, estimate_betas, estimate_fama_macbeth, lag_column, list_supported_indexes - 0.3.0
- 0.2.12024-07-03 · diff ↗
- 0.2.0
Show 3 earlier eventsHide 3 earlier events
- RR 4.4.0 released · 2024-04-24
- 0.1.02024-03-05
- RR 4.3.0 released · 2023-04-21
Package metadata
- First published
- 2024-03-05
- Total releases
- 15 / 2 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.1
- Download size
- 237 KB
Cite
Cite this package
Run in R for the authors' entry:
citation("tidyfinance")The package provides a citation file, so citation() returns the authors' own entry.
It points to 10.1201/b23237.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.