Package 'threesixtygiving'

Title: Download Charitable Grants from the '360Giving' Platform
Description: Access open data from <https://www.threesixtygiving.org>, a database of charitable grant giving in the UK operated by '360Giving'. The package provides functions to search and retrieve data on charitable grant giving, and process that data into tidy formats. It relies on the '360Giving' data standard, described at <https://standard.threesixtygiving.org/>.
Authors: Evan Odell [aut, cre]
Maintainer: Evan Odell <[email protected]>
License: GPL-3
Version: 0.2.2
Built: 2025-03-01 03:21:14 UTC
Source: https://github.com/evanodell/threesixtygiving

Help Index


threesixtygiving package

Description

360Giving is a data standard for publishing information about charitable grant giving in the UK. threesixtygiving provides functions to retrieve and process charitable grant funding data from 360Giving.

Details

See the 360 Giving website for more information on the source of this data, and the 360Giving Standard page for details of the data standard this package relies on.


All grants

Description

Returns a list of data frames with details of all grants from funders returned by tsg_available().

Usage

tsg_all_grants(verbose = TRUE, timeout = 30, retries = 0, correct_names = TRUE)

Arguments

verbose

If TRUE, prints console messages on data retrieval progress. Defaults to TRUE.

timeout

The maximum request time, in seconds. If data is not returned in this time, a value of NA is returned for that dataset. Defaults to 30 seconds.

retries

The number of retries to make if a request is not successful. Defaults to 0.

correct_names

If TRUE, corrects known mistakes in column names, such as spelling mistakes. Defaults to TRUE.

Details

Due to the structure of the 360 Giving data, the package will make multiple attempts to request data. This can cause issues with servers automatically blocking requests. You can use tsg_missing() to identify missing sets of grant data.

Value

A list of tibbles with grant data.

Examples

## Not run: 
all_grants <- tsg_all_grants()

## End(Not run)

Available datasets

Description

Returns a tibble with information on all datasets available through 360Giving. Some funders have multiple datasets

Usage

tsg_available()

Value

A tibble with details on all available datasets.

Examples

## Not run: 
available <- tsg_available()

## End(Not run)

Core Data

Description

Given a list returned by tsg_all_grants() or tsg_search_grants(), creates a tibble with the core variables required by the 360Giving open standard, as well as the publisher prefix and dataset identifier, which are useful for data processing, and the licence the data was published under.

Usage

tsg_core_data(x, verbose = TRUE)

Arguments

x

A list of tibble with grant data returned by tsg_all_grants().

verbose

If TRUE, prints console messages on data retrieval progress. Defaults to TRUE.

Value

A tibble with the core variables in the 360Giving standard.

See Also

tsg_process_data(), which does the same processing but returns all available variables.

Examples

## Not run: 
grants <- tsg_all_grants()

df <- tsg_core_data(grants)

## End(Not run)

Identify missing data sets

Description

Returns a tibble with details on any available data missing from a list of grants returned by tsg_all_grants().

Usage

tsg_missing(x)

Arguments

x

A list of tibble with grant data returned by tsg_all_grants().

Value

A tibble with details on funders missing data from a list of tibbles passed to the function.

Examples

## Not run: 
all_grants <- tsg_all_grants()

missing_grants <- tsg_missing(all_grants)

## End(Not run)

Convert data to tibble

Description

Given a list returned by tsg_all_grants() or tsg_search_grants(), creates a tibble with all available variables. This tibble contains roughly 200 columns if all available grants are used (as of October 2019), due to differences in how grant data is labelled and structured.

Usage

tsg_process_data(x, min_coverage = 0, verbose = TRUE)

Arguments

x

A list of tibble with grant data returned by tsg_all_grants().

min_coverage

A number from 0 to 1. If >0, only returns variables with a value other than NA for at least that proportion of rows. Defaults to 0 and returns all columns.

verbose

If TRUE, prints console messages on data retrieval progress. Defaults to TRUE.

Value

A tibble with all variables from all provided grants.

See Also

tsg_core_data(), which does the same processing but only returns the core variables in the 360Giving standard.

Examples

## Not run: 
grants <- tsg_all_grants()

df1 <- tsg_process_data(grants)

# Only return data from columns with more than 50% coverage
df2 <- tsg_process_data(grants, min_coverage = 0.5)

## End(Not run)

Search funders

Description

Return a tibble with information on all grant datasets where funder data matches one or more search strings.

Usage

tsg_search_funders(
  search,
  search_in = NULL,
  verbose = TRUE,
  ignore_case = TRUE,
  perl = FALSE,
  fixed = FALSE
)

Arguments

search

The string(s) to search for. By default allows POSIX 1003.2 regular expressions. Use perl = TRUE for perl-style regex, or fixed = TRUE for fixed strings. Accepts single strings or a character vector of strings.

search_in

The name of the column to search in. Accepts single strings or a character vector of column names. If NULL, searches all columns.

verbose

If TRUE, prints console messages on data retrieval progress. Defaults to TRUE.

ignore_case

If TRUE ignores case.

perl

If TRUE, uses perl-style regex.

fixed

If TRUE, searches will be matched as-is.

Value

A tibble with information on matching datasets

See Also

tsg_search_grants() for retrieving all grants from matching funders.

Examples

## Not run: 
search1 <- tsg_search_funders(search = c("bbc", "caBinet"))

## End(Not run)

Search for specific datasets

Description

Returns a list of tibbles with details of all grants from specific funders.

Usage

tsg_search_grants(
  search,
  search_in = NULL,
  verbose = TRUE,
  ignore_case = TRUE,
  perl = FALSE,
  fixed = FALSE,
  ...
)

Arguments

search

The string(s) to search for. By default allows POSIX 1003.2 regular expressions. Use perl = TRUE for perl-style regex, or fixed = TRUE for fixed strings. Accepts single strings or a character vector of strings.

search_in

The name of the column to search in. Accepts single strings or a character vector of column names. If NULL, searches all columns.

verbose

If TRUE, prints console messages on data retrieval progress. Defaults to TRUE.

ignore_case

If TRUE ignores case.

perl

If TRUE, uses perl-style regex.

fixed

If TRUE, searches will be matched as-is.

...

Additional params passed to tsg_all_grants()

Details

tsg_search_grants retrieves grants where funder data matches one or more search strings. If only one dataset matches queries, returns a tibble of that dataset. Use tsg_specific_df() to pass a dataframe.

Value

A single tibble (if only one grant maker matches the queries) or a list of tibbles (if the query matches multiple datasets).

See Also

tsg_search_funders() for retrieving information on available datasets from matching funders. tsg_specific_df() to retrieve data contained with all or specific rows of a tibble returned by tsg_available() or tsg_missing().

Examples

## Not run: 
specific1 <- tsg_search_grants(search = c("bbc", "caBinet"))

## End(Not run)

Get specific datasets

Description

Retrieve data contained with all or specific rows of a tibble returned by tsg_available() or tsg_missing().

Usage

tsg_specific_df(x, verbose = TRUE, timeout = 30, retries = 0)

Arguments

x

All or a subset of a tibble returned by tsg_available() or tsg_missing()

verbose

If TRUE, prints console messages on data retrieval progress. Defaults to TRUE.

timeout

The maximum request time, in seconds. If data is not returned in this time, a value of NA is returned for that dataset. Defaults to 30 seconds.

retries

The number of retries to make if a request is not successful. Defaults to 0.

Value

A list of tibbles with grant data.

See Also

tsg_search_grants()

tsg_available()

tsg_missing()

Examples

## Not run: 
all_grants <- tsg_all_grants()

missing_grants <- tsg_missing(all_grants)

more_grants <- tsg_specific_df(missing_grants)

## End(Not run)