Package 'prisonbrief'

Title: Downloads and Parses World Prison Brief Data
Description: Download, parses and tidies information from the World Prison Brief project <http://www.prisonstudies.org/>.
Authors: Danilo Freire [aut, cre], Robert McDonnell [aut]
Maintainer: Danilo Freire <[email protected]>
License: MIT + file LICENSE
Version: 0.1.1
Built: 2025-03-06 03:32:54 UTC
Source: https://github.com/danilofreire/prisonbrief

Help Index


Available World Prison Brief countries

Description

Prints a list of available countries to the console.

Usage

wpb_list()

Lists all countries in a region

Description

Creates a list of all countries in a given region.

Usage

wpb_region_list(
  region = c("Africa", "Asia", "Caribbean", "Central America", "Europe", "Middle East",
    "North America", "Oceania", "South America")
)

Arguments

region

character. Return details for all the countries in the particular region. For a list of the countries in each region, use wbp_region_list().


Download and parse World Prison Brief time series data

Description

Download and parse World Prison Brief time series data

Usage

wpb_series(country = NULL)

Arguments

country

Country name, in the url-style used by the World Prison Brief. See note below.

Note

Important: the country names must be the url names associated with the country. These can be seen in the second column of the dataframe returned from wpb_list(). Most of these are simply lower-case versions of the country name, such as 'algeria'. Some, such as "American Samoa (USA)" are in the following format: american-samoa-usa.


Time series data on global prison population.

Description

A dataset containing information on prison population rates and total population over several years.

Usage

wpb_series_data

Format

A data frame with 1567 rows and 4 variables.

Details

  • country character.

  • year numeric.

  • prison_population_total numeric.

  • prison_population_rate numeric.


Download and parse World Prison Brief data

Description

Download and parse World Prison Brief data

Usage

wpb_table(
  region = c("Africa", "Asia", "Caribbean", "Central America", "Europe", "Middle East",
    "North America", "Oceania", "South America", "All"),
  country = NULL
)

Arguments

region

character. Return details for all the countries in the particular region. For a list of the countries in each region, use wbp_region_list().

country

character. If details of a specific country are required, the country can be specified by name. A non-NULL value for this parameter will void the region argument. For a list of country names, use wpb_list().

Value

Data Frame with 10 variables:

  • country character.

  • prison_population_rate integer, per 100,000 of the national population.

  • prison_population_total integer.

  • female_prisoners numeric, (percentage of total prison pop.).

  • pre_trial_detainees numeric, (percentage of total prison pop.).

  • foreign_prisoners numeric, (percentage of total prison pop.).

  • occupancy_level numeric, (percentage based on official capacity).

  • iso_a2 character. See notes.

  • geometry sfc_MULTIPOLYGON.

Note

We recommend calling this function using the region argument, as the data come back in a format more useful for analysis. Querying a specific country will return a dataframe in which certain columns contain items such as parentheses and auxiliary text, rendering follow-on analysis more cumbersome. As regards the spatial information, the geometry column will be an empty list where it has not matched every entry in country. This is due to the way territories are coded according to ISO A2 codes. For example, country will contain "Jersey (United Kingdom)", whereas geometry contains information for only the United Kingdom as a whole. We hope to improve this in future releases of prisonBrief.

Examples

## Not run: 
# Get details for Spain:
espana <- wpb_table(country = "Spain")

# Get details for Central America:
CA <- wpb_table(region = "Central America")

## End(Not run)

Data on global prison population.

Description

A dataset containing information on prison population for all countries available.

Usage

wpb_tables_data

Format

A data frame with 226 rows and 11 variables.

Details

  • country character.

  • prison_population_total integer.

  • prison_population_rate integer.

  • female_prisoners numeric.

  • pre_trial_detainees numeric.

  • foreign_prisoners numeric.

  • occupancy_level numeric.

  • juvenile_prisoners numeric.

  • number_institutions numeric.

  • iso_a2 character.

  • geometry sfc_MULTIPOLYGON.