Title: | Visualize 'Reproducibility' and 'Replicability' in a Comparison of Scientific Studies |
---|---|
Description: | Users may specify what fundamental qualities of a new study have or have not changed in an attempt to reproduce or replicate an original study. A comparison of the differences is visualized. Visualization approach follows 'Patil', 'Peng', and 'Leek' (2016) <doi:10.1101/066803>. |
Authors: | Prasad Patil [aut, cre], Gehlenborg Nils [ctb], Muschelli John [ctb], Leek Jeff [aut] |
Maintainer: | Prasad Patil <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2 |
Built: | 2025-02-12 04:10:40 UTC |
Source: | https://github.com/prpatil/scifigure |
Change Icon Color
change_icon_color(icon, color)
change_icon_color(icon, color)
icon |
icon, which is a 4D array |
color |
color to change, in text form, passed to |
A 4D array of the icon
icon = scifigure::icons[[2]] color = "blue" original_color = "red" icon2 = change_icon_color(icon, color)
icon = scifigure::icons[[2]] color = "blue" original_color = "red" icon2 = change_icon_color(icon, color)
A dataset containing icon images used to render all figures in the scifigure package.
icons
icons
A list of length 44, with each item a 75x75x4 bitmap
A dataset containing icon images showing difference rather than entity used to render all difference figures in the scifigure package.
icons_diff
icons_diff
A list of length 44, with each item a 75x75x4 bitmap
sci_figure
init_experiments
generates a dataframe with the proper row and
column headers for user manipulation before calling sci_figure
init_experiments( nexp = 3, exp_names = paste0("Exp", 1:nexp), stage_names = c("population", "question", "hypothesis", "experimental_design", "experimenter", "data", "analysis_plan", "analyst", "code", "estimate", "claim") )
init_experiments( nexp = 3, exp_names = paste0("Exp", 1:nexp), stage_names = c("population", "question", "hypothesis", "experimental_design", "experimenter", "data", "analysis_plan", "analyst", "code", "estimate", "claim") )
nexp |
The number of scientific experiments to be represented in the data frame, i.e. number of columns. |
exp_names |
The names of each experiment, i.e. column names. Default: "Exp1, Exp2, ..." |
stage_names |
The names of each step in the process, i.e. row names. Defaults match Patil et. al. |
# Generate the default data frame of three experiments init_experiments() init_experiments(nexp = 5, exp_names = c("Run_16_01", "Run_16_04", "Run_16_07", "Run_16_09", "Run_16_12")) testthat::expect_error({ init_experiments(nexp = 2, exp_names = names) })
# Generate the default data frame of three experiments init_experiments() init_experiments(nexp = 5, exp_names = c("Run_16_01", "Run_16_04", "Run_16_07", "Run_16_09", "Run_16_12")) testthat::expect_error({ init_experiments(nexp = 2, exp_names = names) })
replicate_figure
is a wrapper around the sci_figure
function
to illustrate replicability in a two-experiment setting. Options for
sci_figure
are accepted, but this may be run as is.
replicate_figure(...)
replicate_figure(...)
... |
Additional arguments passed to |
sci_figure
for additional arguments.
reproduce_figure
is a wrapper around the sci_figure
function
to illustrate reproducibility in a two-experiment setting. Options for
sci_figure
are accepted, but this may be run as is.
reproduce_figure(...)
reproduce_figure(...)
... |
Additional arguments passed to |
sci_figure
for additional arguments.
sci_figure
creates a graphical representation of changes in a
a set of subsequent studies or reproduction attempts as compared to an
original study.
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(incorect = "#D20000", different = "#007888", unobserved = "#CDCDCD", original = "black"), leg_text = c("Incorrect", "Different", "Unobserved", "Original"), fontsize = 16, fig.height = 0.08, fig.width = 0.05 )
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(incorect = "#D20000", different = "#007888", unobserved = "#CDCDCD", original = "black"), leg_text = c("Incorrect", "Different", "Unobserved", "Original"), fontsize = 16, fig.height = 0.08, fig.width = 0.05 )
experiments |
A data frame, which can be initialized with |
custom_icons |
(optional) A list of bitmap matrices of custom icon images of length
matching |
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 |
(optional) A character vector with the names of the stages
in the scientific experiment, i.e. rownames of |
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 |
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. |
fontsize |
Size of the font. A calculation will change it but you can adjust this accordingly |
fig.height |
Height of the figures |
fig.width |
Width of the figures |
For the parameter experiments
, the four values any cell may take
are: observed
, different
, unobserved
, incorrect
.
# Initialize the default experiments data frame exps <- init_experiments() sci_figure(exps) experiments = exps experiments["analyst", "Exp2"] <- "different" cols = c("#D20000", "yellow", "#CDCDCD", "black") sci_figure(experiments, cols = cols) sci_figure(experiments, cols = cols, diff = TRUE) sci_figure(experiments, cols = cols, diff = TRUE, hide_stages = "population") sci_figure(experiments, cols = c("yellow", "#CDCDCD", "black"), leg_text = c("Different", "Unobserved", "Original"), diff = TRUE) hide_stages = NULL diff = FALSE 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")
# Initialize the default experiments data frame exps <- init_experiments() sci_figure(exps) experiments = exps experiments["analyst", "Exp2"] <- "different" cols = c("#D20000", "yellow", "#CDCDCD", "black") sci_figure(experiments, cols = cols) sci_figure(experiments, cols = cols, diff = TRUE) sci_figure(experiments, cols = cols, diff = TRUE, hide_stages = "population") sci_figure(experiments, cols = c("yellow", "#CDCDCD", "black"), leg_text = c("Different", "Unobserved", "Original"), diff = TRUE) hide_stages = NULL diff = FALSE 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")