summary.replication()
method:output_table()
functionalityknitr::opts_chunk$set(warning=FALSE, message=FALSE, error=FALSE, eval = FALSE, echo = TRUE)
create_replication()
The function takes main parts of replication object as an arguments and returns the replication class object. (see create_replication.R for code).
The function takes 6 main arguments arguments (defaults are given in parentheses if specified):
description_list
: List of miscellaneous descriptions of replication. Example:description_list = list( study_name = "Fake Study", study_authors = c("Georgiy Syunyaev", "Someone Else"), study_affiliations = c("Columbia University", "Some Other University"), rep_authors = c("Georgiy Syunyaev"), study_abstract = paste0("The aim of this study is to test the create_replication() functionality. ", "This is the first attempt at creatreplication class of objects in [R] ", "for systematic storage and access to study replication materials.") )
packages
(= NULL
): Character vector of packages required for replication in [R]
.project_path
(= NULL
): Character string giving the path to the directory, where function and replication scripts are stored. Defaults to NULL
, which is reasonable if RStudio project is used.data_list
: A named list of data-frames used for the replication. Example:data_list = list(data_admin = data_admin, data_individual = data_individual)
function_script_path
: Character string giving the name of [R]
script which contains all functions required for the replication. The script should only include declarations of named functions using <-
operator. See replication_functions.R for example.replication_script_path
: Character string giving the name of [R]
script which contains all calls for table replications. The script should consist of only single calls for replication of one table and the table objects should be created using <-
operator. See replication_script.R for example.There are also 2 additional arguments:
quietly
(= FALSE
): Logical. Whether the creation of replication should go without any messages printed to console
.checks
(= TRUE
): Logical. If quietly = FALSE
, whether the checks for packages and consistency of replication should be performed.summary()
The function takes replication object and either returns miscellaneous description of the object, or if additional arguments are specified, then only summary of parts of object are returned. (see summary.R for code).
The function takes the following arguments:
object
: Object of class replication
created by create_replication()
.table
(= NULL
): Character string specifying the table to be replicated. The table name should include number of the table as specified in replication_script_path
file and the word "table".published
(= FALSE
): Logical. Whether to show columns with specifications published in the paper.registered
(= FALSE
): Logical. Whether to show columns with specifications registered in PAP.script
(= FALSE
): Logical. Whether to print the script to replicate the results of the study. If table = NULL
, then returns preamble which includes all the functions and packages required for replication. If table != NULL
, then returns preamble and the code for replication of the specified table.desc
(= FALSE
): To be implemented...devtools::install_github("gerasy1987/replication", quiet = TRUE) library(replication) load(file = "example/replication_data.Rdata")
create_replication()
( x <- create_replication( data_list = list(data_admin = data_admin, data_individual = data_individual), packages = c("plyr", "dplyr", "broom", "Hmisc", "lfe", "multiwayvcov", "lmtest", "wakefield", "magrittr"), project_path = "example/", function_script_path = "replication_functions.R", replication_script_path = "replication_script.R", description_list = list(study_name = "Fake Study", study_authors = c("Georgiy Syunyaev", "Someone Else"), study_affiliations = c("Columbia University", "Some Other University"), rep_authors = c("Georgiy Syunyaev"), study_abstract = paste0("The aim of this study is to test the create_replication() functionality. ", "This is the first attempt at creatreplication class of objects in [R] ", "for systematic storage and access to study replication materials.")), quietly = TRUE, checks = TRUE ) )
summary.replication()
summary(x)
summary(x, table = "table_1", published = TRUE, registered = FALSE) summary(x, table = "table_2", published = TRUE, registered = TRUE)
summary(x, script = TRUE) summary(x, table = "table_1", script = TRUE)
download.file("https://github.com/gerasy1987/replicate/blob/master/example/fake_study.rdata?raw=True","fake_study.rdata") load("fake_study.rdata")
# Overall summary of the study summary(fake_study) # Here are the published results for Table 1 summary(fake_study, table = "table_1", published = TRUE, registered = FALSE) # Here are the results for Table 1 registered in PAP summary(fake_study, table = "table_2", published = FALSE, registered = TRUE) # Here are both registered and published results for Table 1 summary(fake_study, table = "table_2", published = TRUE, registered = TRUE) # Here is the preamble code you have to run to replicate any of the results in the study summary(fake_study, script = TRUE) # Here is the script which will reproduce Table 1 # if you have replication object in your R environment # (which you have to have to run any of the above commands) summary(fake_study, table = "table_1", script = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.