| Type: | Package |
| Title: | Access the Political Science Replication Index from R |
| Version: | 0.1.0 |
| Description: | Search and browse the Political Science Replication Index (https://jsakowuah.github.io/polisci-replication/), a searchable, tagged index of replication packages crawled monthly from flagship political science journals' Harvard Dataverse collections, without leaving R. Provides functions to download and cache the index locally and to search and filter it by journal, method, data type, and year. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.3 |
| Imports: | jsonlite, tibble, tools, utils |
| Suggests: | dataverse, knitr, rmarkdown, testthat (≥ 3.1.4) |
| Config/testthat/edition: | 3 |
| VignetteBuilder: | knitr |
| URL: | https://github.com/jsakowuah/psreplicate, https://jsakowuah.github.io/polisci-replication/ |
| BugReports: | https://github.com/jsakowuah/psreplicate/issues |
| NeedsCompilation: | no |
| Packaged: | 2026-07-27 03:39:10 UTC; josep |
| Author: | Joseph Akowuah [aut, cre, cph] |
| Maintainer: | Joseph Akowuah <siawjoe@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-08-05 08:30:02 UTC |
psreplicate: Access the Political Science Replication Index from R
Description
Search and browse the Political Science Replication Index (https://jsakowuah.github.io/polisci-replication/) without leaving R. The index aggregates replication-package metadata crawled monthly from flagship political science journals' Harvard Dataverse collections and tags each record by method and data type.
Getting started
-
list_functions()lists every function this package exports. -
search_replications()searches and filters the whole index at once;search_by_title(),search_by_abstract(),search_by_author(),search_by_journal(),search_by_method(),search_by_data_type(), andsearch_by_year()do the same one field at a time. -
list_journals(),list_methods(), andlist_data_types()show what values are actually valid to search on. -
dataset_info()andbrowse_dataset()look up or open one record by DOI. -
list_dataset_files()anddownload_dataset()get the actual replication files onto disk;load_dataset_file()loads one file straight into R with no disk step (all three require the dataverse package). -
refresh_index()downloads (or re-downloads) the index.
Author(s)
Maintainer: Joseph Akowuah siawjoe@gmail.com [copyright holder]
See Also
Useful links:
Report bugs at https://github.com/jsakowuah/psreplicate/issues
Open a dataset's page in your web browser
Description
Looks up the record by DOI and opens its url with utils::browseURL(),
so you can go from a search result straight to the dataset itself without
copying a link.
Usage
browse_dataset(doi)
Arguments
doi |
The dataset's DOI (see |
Value
Invisibly, the URL that was opened.
Examples
browse_dataset("doi:10.7910/DVN/PRYYZ5")
Look up a single record by DOI
Description
Look up a single record by DOI
Usage
dataset_info(doi)
Arguments
doi |
The dataset's DOI, e.g. |
Value
A one-row tibble::tibble(), or a zero-row tibble if no record
matches (see search_replications() for the column definitions).
Examples
dataset_info("doi:10.7910/DVN/PRYYZ5")
Download a dataset's files
Description
Downloads a replication package's files to a local directory, without
leaving R. Requires the dataverse package
(install.packages("dataverse")); this is a thin convenience wrapper
around it, scoped to this index's data and DOI format.
Usage
download_dataset(doi, dest = tempfile("psreplicate_"), files = NULL)
Arguments
doi |
The dataset's DOI (see the |
dest |
Directory to download into. Created if it doesn't exist. Defaults to a new temporary directory. |
files |
Optional character vector of filenames to download (see
|
Value
Invisibly, a character vector of the local file paths written. A file that fails to download (e.g. access-restricted) is skipped with a warning rather than aborting the rest of the download.
Examples
hit <- search_by_title("Rebel Victory and Authoritarian")
download_dataset(hit$doi[1])
List data-type tags used in the index
Description
The valid values to pass to search_by_data_type() or
search_replications()'s data_type argument aren't documented
anywhere else - this lists exactly what's actually in the data, most
common first.
Usage
list_data_types()
Value
A tibble::tibble() with columns data_type and n_records.
Examples
list_data_types()
List the files in a dataset
Description
Previews what's available before downloading anything with
download_dataset(). Requires the dataverse package
(install.packages("dataverse")), which does the actual work of talking
to Harvard Dataverse's file API.
Usage
list_dataset_files(doi)
Arguments
doi |
The dataset's DOI (see the |
Value
A tibble::tibble() with columns filename, filesize (bytes),
and content_type.
Examples
hit <- search_by_title("Rebel Victory and Authoritarian")
list_dataset_files(hit$doi[1])
List every function this package exports
Description
A quick reference, since the API is spread across several small,
single-purpose functions rather than one do-everything call. Equivalent
information is available via library(help = "psreplicate"), but this is
meant to be more skimmable.
Usage
list_functions()
Value
A tibble::tibble() with columns function_name and
description, in the order you'd typically reach for them.
Examples
list_functions()
List journals covered by the index
Description
List journals covered by the index
Usage
list_journals()
Value
A tibble::tibble() with one row per journal currently
represented in the index: journal_short, journal_name, and
n_records (the number of indexed replication packages).
Examples
list_journals()
List method tags used in the index
Description
The valid values to pass to search_by_method() or
search_replications()'s method argument aren't documented anywhere
else - this lists exactly what's actually in the data, most common first.
Usage
list_methods()
Value
A tibble::tibble() with columns method and n_records.
Examples
list_methods()
Load one file from a dataset directly into R
Description
Unlike download_dataset(), this never writes anything to disk. Tabular
files (.tab/.dta/.csv/etc. that Dataverse has ingested) come back
as a tibble; .rds files are deserialized directly with readRDS() as
whatever R object they contain; other plain-text files (scripts,
READMEs) come back as a character vector of lines; anything else (PDFs,
images, other binaries) comes back as a raw vector, since there's no
sensible in-memory representation otherwise. Requires the
dataverse package (install.packages("dataverse")).
Usage
load_dataset_file(doi, filename)
Arguments
doi |
The dataset's DOI (see the |
filename |
The file to load, exactly as it appears in
|
Value
A tibble::tibble() for tabular files, whatever R object was
saved for .rds files, a character vector for plain-text files, or a
raw vector otherwise.
Examples
hit <- search_by_title("Rebel Victory and Authoritarian")
load_dataset_file(hit$doi[1], "area.tab")
Download or refresh the local copy of the replication index
Description
Downloads the current Political Science Replication Index and stores it
in a per-session-independent, per-user cache directory (see
tools::R_user_dir()), so subsequent calls to search_replications()
and list_journals() don't need network access. The cache is refreshed
automatically once it is more than a day old; call this directly to force
an update sooner.
Usage
refresh_index(force = FALSE)
Arguments
force |
Logical; re-download even if a cached copy less than a day
old already exists. Default |
Value
Invisibly, the path to the cached index file.
Examples
refresh_index()
Search by abstract only
Description
Matches only the dataset's abstract/description text (the description
column), not title or authors.
Usage
search_by_abstract(query)
Arguments
query |
Search term, matched case-insensitively as a substring. |
Value
A tibble::tibble() of matching records (see search_replications()
for the column definitions).
Examples
search_by_abstract("difference-in-differences")
Search by author name
Description
Matches only the authors column (each a "Last, First; Last, First"
string), not title or abstract.
Usage
search_by_author(query)
Arguments
query |
Search term, matched case-insensitively as a substring. |
Value
A tibble::tibble() of matching records (see search_replications()
for the column definitions).
Examples
search_by_author("Wantchekon")
Get all records tagged with a given data type
Description
Get all records tagged with a given data type
Usage
search_by_data_type(data_type)
Arguments
data_type |
Character vector of data-type tags; a record matches if it has at least one of the given tags. |
Value
A tibble::tibble() of matching records (see search_replications()
for the column definitions).
Examples
search_by_data_type("Elections / Voting")
Get all records from a journal
Description
Get all records from a journal
Usage
search_by_journal(journal)
Arguments
journal |
Character vector of journal short codes (see
|
Value
A tibble::tibble() of matching records (see search_replications()
for the column definitions).
Examples
search_by_journal("AJPS")
search_by_journal(c("AJPS", "APSR"))
Get all records tagged with a given method
Description
Get all records tagged with a given method
Usage
search_by_method(method)
Arguments
method |
Character vector of method tags; a record matches if it has at least one of the given tags. |
Value
A tibble::tibble() of matching records (see search_replications()
for the column definitions).
Examples
search_by_method("Survey Experiment")
Search by title only
Description
Unlike search_replications()'s query argument, which matches across
title, abstract, and authors together, this matches only the title.
Usage
search_by_title(query)
Arguments
query |
Search term, matched case-insensitively as a substring. |
Value
A tibble::tibble() of matching records (see search_replications()
for the column definitions).
Examples
search_by_title("regression discontinuity")
Get all records published in given year(s)
Description
Get all records published in given year(s)
Usage
search_by_year(year)
Arguments
year |
Integer vector of publication years, e.g. |
Value
A tibble::tibble() of matching records (see search_replications()
for the column definitions).
Examples
search_by_year(2020:2024)
Search the Political Science Replication Index
Description
Search the Political Science Replication Index
Usage
search_replications(
query = NULL,
journal = NULL,
method = NULL,
data_type = NULL,
year = NULL
)
Arguments
query |
Optional free-text search term, matched case-insensitively against each record's title, description, and author names. |
journal |
Optional character vector of journal short codes (see
|
method |
Optional character vector of method tags to filter to; a record matches if it has at least one of the given tags. |
data_type |
Optional character vector of data-type tags; same
matching rule as |
year |
Optional integer vector of publication years (e.g. |
Value
A tibble::tibble() of matching records, with one row per
replication package and columns journal_short, title, doi, url,
authors (a single "Last, First; Last, First" string), year,
description, method_tags, data_type_tags.
Examples
search_replications(query = "regression discontinuity", journal = "AJPS")
search_replications(method = "Survey Experiment", year = 2020:2024)