GitHub version Build Status Coverage Status

TODO

Description of the replicate functionality:

knitr::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(
    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.")
  )
data_list = list(data_admin = data_admin, data_individual = data_individual)

There are also 2 additional arguments:

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:

Examples

devtools::install_github("gerasy1987/replication", quiet = TRUE)

library(replication)

load(file = "example/replication_data.Rdata")

Use of 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
  )
)

Use of summary.replication()

  1. Genearal summary
summary(x)
  1. Table summary
summary(x, table = "table_1", published = TRUE, registered = FALSE)
summary(x, table = "table_2", published = TRUE, registered = TRUE)
  1. Replication script
summary(x, script = TRUE)
summary(x, table = "table_1", script = TRUE)

Showcase for pre-existing replication object

  1. Download the archive
download.file("https://github.com/gerasy1987/replicate/blob/master/example/fake_study.rdata?raw=True","fake_study.rdata")
load("fake_study.rdata")
  1. Summarize the archive
# 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)


gerasy1987/replication documentation built on May 17, 2019, 2:10 a.m.