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 |
Prints a list of available countries to the console.
wpb_list()
wpb_list()
Creates a list of all countries in a given region.
wpb_region_list( region = c("Africa", "Asia", "Caribbean", "Central America", "Europe", "Middle East", "North America", "Oceania", "South America") )
wpb_region_list( region = c("Africa", "Asia", "Caribbean", "Central America", "Europe", "Middle East", "North America", "Oceania", "South America") )
region |
|
Download and parse World Prison Brief time series data
wpb_series(country = NULL)
wpb_series(country = NULL)
country |
Country name, in the url-style used by the World Prison Brief. See note below. |
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
.
A dataset containing information on prison population rates and total population over several years.
wpb_series_data
wpb_series_data
A data frame with 1567 rows and 4 variables.
country character
.
year numeric
.
prison_population_total numeric
.
prison_population_rate numeric
.
Download and parse World Prison Brief data
wpb_table( region = c("Africa", "Asia", "Caribbean", "Central America", "Europe", "Middle East", "North America", "Oceania", "South America", "All"), country = NULL )
wpb_table( region = c("Africa", "Asia", "Caribbean", "Central America", "Europe", "Middle East", "North America", "Oceania", "South America", "All"), country = NULL )
region |
|
country |
|
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
.
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.
## 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)
## 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)
A dataset containing information on prison population for all countries available.
wpb_tables_data
wpb_tables_data
A data frame with 226 rows and 11 variables.
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
.