Type: | Package |
Title: | Downloads and Parses World Prison Brief Data |
Version: | 0.1.2 |
URL: | https://danilofreire.github.io/prisonbrief/ |
Description: | Download, parses and tidies information from the World Prison Brief project http://www.prisonstudies.org/. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
LazyData: | yes |
Depends: | R (≥ 3.0) |
Imports: | sf (≥ 0.6.0), dplyr (≥ 0.5.0), httr (≥ 1.2.1), magrittr (≥ 1.5), passport (≥ 0.1.1), rnaturalearth (≥ 0.1.0), rnaturalearthdata (≥ 0.1.0), rvest (≥ 0.3.2), stringr (≥ 1.2.0), tibble (≥ 1.3.3), tidyr (≥ 0.6.3), xml2 (≥ 1.1.1) |
RoxygenNote: | 7.1.0 |
Suggests: | testthat |
NeedsCompilation: | no |
Packaged: | 2021-02-18 03:01:43 UTC; politicaltheory |
Author: | Danilo Freire [aut, cre], Robert McDonnell [aut] |
Maintainer: | Danilo Freire <danilofreire@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2021-02-18 06:20:03 UTC |
Pipe operator
Description
Pipe operator
Usage
lhs %>% rhs
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 |
|
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 |
|
country |
|
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
.