sci_figure: Create a figure depicting reproducibility/replicability of a...

Description Usage Arguments Note See Also Examples

View source: R/sci_figure.R

Description

sci_figure creates a graphical representation of changes in a a set of subsequent studies or reproduction attempts as compared to an original study.

Usage

1
2
3
4
5
6
sci_figure(experiments, custom_icons = NULL,
  stage_names = c("Population", "Question", "Hypothesis", "Exp. Design",
  "Experimenter", "Data", "Analysis Plan", "Analyst", "Code", "Estimate",
  "Claim"), hide_stages = NULL, diff = FALSE, showlegend = TRUE,
  cols = c("#D20000", "#007888", "#CDCDCD", "black"),
  leg_text = c("Incorrect", "Different", "Unobserved", "Original"))

Arguments

experiments

A data frame, which can be initialized with init_experiments(), whose rownames are the predefined stages of a scientifc experiments, columnnames are the names of each experiment, and cell values represent the state of each stage in each experiment (states described below).

custom_icons

(optional) A list of bitmap matrices of custom icon images of length matching experiments input. Bitmap icons must be 75 x 75 pixels. See vignette for detailed instructions and specifications. Default NULL, indicating that default icons will be used.

stage_names

Character vector of names of stages. Default names match Patil et. al. If set to NULL, all names will be suppressed. Use hide_stages (below) to suppress specific stage names.

hide_stages

(optional) A character vector with the names of the stages in the scientific experiment, i.e. rownames of experiments, which the user wishes to suppress from the figure output. The default value of hide_stages is NULL, indicating that all stages will be displayed.

diff

(optional) A Boolean flag to indicate whether the rendering of the figure should emphasize the differences between the experiments ("difference mode"). The difference mode uses a set of four symbols that are semantically close to the scenarios that they are encoding. The default value is FALSE.

showlegend

Do you want the legend to be shown?

cols

colors to use for the specific scenarios when diff = T or custom_icons used.

leg_text

text for legend keys corresponding to the specific colors.

Note

For the parameter experiments, the four values any cell may take are: observed, different, unobserved, incorrect.

See Also

init_experiments

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Initialize the default experiments data frame
exps <- init_experiments()
sci_figure(exps)
sci_figure(exps, hide_stages = c("population", "analyst"))

# Do some manual manipulation to the experiments

exps["analyst", "Exp2"] <- "different"
exps["code", c("Exp2", "Exp3")] <- "unobserved"
sci_figure(exps, showlegend = FALSE)

# Create the same figure using the difference mode

sci_figure(exps, diff=TRUE)
too_many = init_experiments(nexp = 30)

testthat::expect_warning({
sci_figure(too_many)
}, "showing the first")

exp2 = exps
exp2[,1] = "bad"
testthat::expect_error({
sci_figure(exp2)
}, "Invalid cell")

scifigure documentation built on May 2, 2019, 4:01 a.m.