Skip to contents

Fuzzy keyword search across publication name, description, tags, and dataset identifier. Returns a tidy table of matching rows so users can discover what the package exposes (and what is on the roadmap).

Usage

hmrc_search(query = NULL, implemented = NULL, frequency = NULL)

Arguments

query

Character. Keyword or regex pattern. Case-insensitive. Matches anywhere in dataset, publication, description, or tags. If NULL or empty, the full catalogue is returned.

implemented

Logical or NULL. If TRUE, only rows with a working function_name are returned. If FALSE, only roadmap rows. NULL (default) returns both.

frequency

Optional character vector to filter by frequency (e.g. "monthly", "annual").

Value

A data frame, sorted with implemented datasets first.

Examples

# Everything mentioning VAT
hmrc_search("vat")
#>                dataset                                    publication
#> 1           patent_box                  Patent Box reliefs statistics
#> 2 tax_receipts_monthly  HMRC tax receipts and NICs (monthly bulletin)
#> 3          vat_monthly VAT annual statistics (monthly receipts table)
#>       function_name frequency   start
#> 1   hmrc_patent_box    annual 2013-14
#> 2 hmrc_tax_receipts   monthly 2017-04
#> 3          hmrc_vat   monthly 1973-04
#>                                                                                                                              description
#> 1                                                                                  Annual Patent Box election counts and relief claimed.
#> 2 Monthly cash receipts for 42 series (Income Tax, NICs, VAT, Corporation Tax, duties, etc.). Rolling window, currently from April 2017.
#> 3                                       Monthly VAT receipts split into payments, repayments, import VAT, and home VAT, from April 1973.

# Only annual publications already implemented
hmrc_search(implemented = TRUE, frequency = "annual")
#>                           dataset
#> 1        capital_gains_tax_annual
#> 2          corporation_tax_annual
#> 3     creative_industries_reliefs
#> 4 income_tax_liabilities_by_range
#> 5          inheritance_tax_annual
#> 6                      patent_box
#> 7               rd_credits_annual
#> 8               stamp_duty_annual
#> 9                  tax_gap_annual
#>                                          publication            function_name
#> 1                       Capital Gains Tax statistics       hmrc_capital_gains
#> 2                         Corporation Tax statistics     hmrc_corporation_tax
#> 3          Creative Industries tax relief statistics hmrc_creative_industries
#> 4 Income Tax liabilities by income range (Table 2.5)    hmrc_income_tax_stats
#> 5           Inheritance Tax liabilities and receipts     hmrc_inheritance_tax
#> 6                      Patent Box reliefs statistics          hmrc_patent_box
#> 7    Research and Development Tax Credits Statistics          hmrc_rd_credits
#> 8                            UK Stamp Tax statistics          hmrc_stamp_duty
#> 9                                 Measuring Tax Gaps             hmrc_tax_gap
#>   frequency   start
#> 1    annual 1987-88
#> 2    annual 2019-20
#> 3    annual 2006-07
#> 4    annual 2023-24
#> 5    annual 2023-24
#> 6    annual 2013-14
#> 7    annual 2000-01
#> 8    annual 2003-04
#> 9    annual 2005-06
#>                                                                                                                                       description
#> 1                                                    Annual Capital Gains Tax taxpayers, gains and tax liabilities by year of disposal (Table 1).
#> 2 Annual Corporation Tax receipts by levy type (onshore, offshore, Bank Levy, Bank Surcharge, RPDT, EPL, EGL) for the latest six financial years.
#> 3                                               Annual film, HETV, animation, children's TV, video games, theatre, orchestra, and museum reliefs.
#> 4                  Income Tax payers, total income, liability and average rate by income range (Table 2.5): latest outturn year plus projections.
#> 5                                 Estates, tax due, average tax and effective rate by net-estate band for the latest year of death (Table 12.1a).
#> 6                                                                                           Annual Patent Box election counts and relief claimed.
#> 7                                                         Annual R&D tax credit claims and cost for SME R&D Relief and RDEC schemes from 2000-01.
#> 8                    Annual Stamp Duty Land Tax, Stamp Duty Reserve Tax and stamp duty on documents, with share and overall totals, from 2003-04.
#> 9                    Tax gap by tax, taxpayer group and component, as a per cent of liabilities and in GBP bn, from 2005-06 (Tables 1.1 and 1.2).

# Roadmap items mentioning capital gains
hmrc_search("capital gains", implemented = FALSE)
#> [1] dataset       publication   function_name frequency     start        
#> [6] description  
#> <0 rows> (or 0-length row.names)