View source: R/add-expression-col.R
add_expression_col | R Documentation |
Creates an expression from a data frame containing statistical details.
Ideally, this data frame would come from having run tidy_model_parameters
function on your model object.
This function is currently not stable and should not be used outside of this package context.
add_expression_col(
data,
paired = FALSE,
statistic.text = NULL,
effsize.text = NULL,
prior.type = NULL,
n = NULL,
n.text = ifelse(paired, list(quote(italic("n")["pairs"])),
list(quote(italic("n")["obs"]))),
digits = 2L,
digits.df = 0L,
digits.df.error = digits.df,
...
)
data |
A data frame containing details from the statistical analysis and should contain some or all of the the following columns:
|
paired |
Logical that decides whether the experimental design is
repeated measures/within-subjects or between-subjects. The default is
|
statistic.text |
A character that specifies the relevant test statistic.
For example, for tests with t-statistic, |
effsize.text |
A character that specifies the relevant effect size. |
prior.type |
The type of prior. |
n |
An integer specifying the sample size used for the test. |
n.text |
A character that specifies the design, which will determine
what the |
digits , digits.df , digits.df.error |
Number of decimal places to display for the
parameters (default: |
... |
Currently ignored. |
set.seed(123)
# creating a data frame with stats results
stats_df <- cbind.data.frame(
statistic = 5.494,
df = 29.234,
p.value = 0.00001,
estimate = -1.980,
conf.level = 0.95,
conf.low = -2.873,
conf.high = -1.088,
method = "Student's t-test"
)
# expression for *t*-statistic with Cohen's *d* as effect size
# note that the plotmath expressions need to be quoted
add_expression_col(
data = stats_df,
statistic.text = list(quote(italic("t"))),
effsize.text = list(quote(italic("d"))),
n = 32L,
n.text = list(quote(italic("n")["no.obs"])),
digits = 3L,
digits.df = 3L
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.