Description Usage Arguments Note See Also Examples
sci_figure
creates a graphical representation of changes in a
a set of subsequent studies or reproduction attempts as compared to an
original study.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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
.
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # 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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.