Hover underlined terms for examples.
papers/
papers/10.1017S0003055403000534/
replication.yml
code/tab_1.R
data/repdata.dta
artifacts/tab_1.rds
artifacts/manifest.json
in the registry repository.
replication.yml
paper:
doi: https://doi.org/10.1017/S0003055403000534
title: Ethnicity, Insurgency, and Civil War
dependencies:
- haven
- modelsummary
replications:
- id: tab_1
type: table
label: Table 1
data: data/repdata.dta
code: code/tab_1.R
format: format_tab_1
artifact: artifacts/tab_1.rds
,
code/
# Paper folder: https://github.com/replicate-anything/registry/
# tree/main/papers/10.1017S0003055403000534
library(haven)
library(modelsummary)
library(kableExtra)
make_tab_1 <- function(data) { ... }
format_tab_1 <- function(object) { ... }
make_tab_1(haven::read_dta("../data/repdata.dta")) |> format_tab_1()
, and
data/
.
make_tab_1(data)
make_tab_1 <- function(data) {
glm(onset ~ warl + gdpenl + lpopl, data = data,
family = binomial())
}
format_tab_1 <- function(object) {
modelsummary::modelsummary(
object,
output = "kableExtra",
stars = TRUE
)
}
for analysis and
format_tab_1(object)
make_tab_1 <- function(data) {
glm(onset ~ warl + gdpenl + lpopl, data = data,
family = binomial())
}
format_tab_1 <- function(object) {
modelsummary::modelsummary(
object,
output = "kableExtra",
stars = TRUE
)
}
for display. Register with
format: format_tab_1
paper:
doi: https://doi.org/10.1017/S0003055403000534
title: Ethnicity, Insurgency, and Civil War
dependencies:
- haven
- modelsummary
replications:
- id: tab_1
type: table
label: Table 1
data: data/repdata.dta
code: code/tab_1.R
format: format_tab_1
artifact: artifacts/tab_1.rds
so artifacts store analysis output (usually
.rds
). Omit
format
when analysis and formatting cannot be separated. Figures use
make_fig_1(data)
- id: fig_1
type: figure
data: data/example.csv
code: code/fig_1.R
artifact: artifacts/fig_1.png
make_fig_1 <- function(data) {
ggplot2::ggplot(data, ggplot2::aes(x, y)) +
ggplot2::geom_line()
}
and save
.png
artifacts.
# Paper folder: https://github.com/replicate-anything/registry/
# tree/main/papers/10.1017S0003055403000534
library(haven)
library(modelsummary)
library(kableExtra)
make_tab_1 <- function(data) { ... }
format_tab_1 <- function(object) { ... }
make_tab_1(haven::read_dta("../data/repdata.dta")) |> format_tab_1()
: include
library()
calls, a commented link to the paper folder on GitHub, and a footer that loads
data/
via a local path (works when run from
code/
or the paper folder).
Rscript scripts/build_artifacts.R
cd registry
Rscript scripts/build_artifacts.R
# one paper only:
Rscript scripts/build_artifacts.R papers/10.1017S0003055403000534
Rscript scripts/validate_artifacts.R
in the registry to precompute
artifacts/
for the app.