View source: R/createStudyTable.R
createStudyTable | R Documentation |
This function creates an overview table containing selected study information.
createStudyTable(.data, ..., .round.by.digits = NULL, .column.names = NULL, .na.replace = "nr", .html = TRUE)
.data |
Meta-analysis study data. Typically data created by the
|
... |
<dplyr_data_masking>. The name of several columns
(included in |
.round.by.digits |
named |
.column.names |
named |
.na.replace |
|
.html |
|
General Purpose: This function allows to select variables to be included in a study table. Such study tables are typically part of a meta-analysis report/article. Variables are included by adding their names to the function call and separating them with commas. The columns will appear in the exact same order as specified in the function.
Trial-Arm Variables: Before producing the final table, createStudyTable
will filter out all redundant
rows based on the selected variables. If you want to include information that differs
between the (two or more) trial arms (e.g. the sample size of each group) as separate columns, you have to
use addTrialArmInfo
first. This ensures that individual columns are created
for both the intervention and control group (e.g. N_ig
and N_cg
),
which can then be included in the call to createStudyTable
.
Changing Values: The function also allows to change specified values within a variable. Factor levels
encoded as numbers, for example (e.g. country = 1
for European studies, and so
forth) can be changed by adding a concatenated (c
) vector to the
name of the variable. This vector should contain the new value as a character
on the left side, and the old value on the right side,
separated by '=
' (e.g. country = c("Europe" = "1")
).
The values will then be recoded before producing the table.
HTML Table: By default, createStudyTable
produces an HTML table using
kable
. The HTML table makes copy & paste easier, particularly
when working with MS Word, since the table formatting is kept.
For more details see the help vignette: vignette("metapsyTools")
.
Returns a data.frame
with all the selected variables. If .html
is
TRUE
, an HTML table will also be produced.
Mathias Harrer mathias.h.harrer@gmail.com, Paula Kuper paula.r.kuper@gmail.com, Pim Cuijpers p.cuijpers@vu.nl
addTrialArmInfo
, kable_styling
## Not run: # Filter out all primary outcomes, check data, # expand multiarm trials, calculate effect sizes, # expand information that differs between trial arms; # then produce study table using selected information. inpatients %>% filter(primary == 1) %>% checkDataFormat() %>% checkConflicts() %>% expandMultiarmTrials() %>% calculateEffectSizes() %>% createStudyTable( study, diag = c("Cutoff" = "3", "Mood" = "2", "MDD" = "1"), agegrp2, ADD_setting = c("Nursing" = "nursing", "Other" = "other", "Psychiatric" = "psych"), meanage, propwomen, type_trt1 = c("CBT" = "cbt", "Other" = "other", "PST" = "pst", "BA" = "bat", "LR" = "lrt", "PDT" = "dyn", "IPT" = "ipt"), nsess_trt1, Post_N_trt1, Post_N_trt2, Cond_spec_trt1, Cond_spec_trt2, country = c("Canada" = "4", "Europe" = "3", "USA" = "1", "Asia" = "6", "Middle East" = "7", "Australia" = "5"), sg, ac, ba, itt, .round.by.digits = list(meanage = 0, Post_N_trt1 = 0, Post_N_trt2 = 0), .column.names = list(agegrp2 = "age group", ADD_setting = "setting", Post_N_trt1 = "N_ig", Post_N_trt2 = "N_cg", Cond_spec_trt1 = "format_ig", Cond_spec_trt2 = "format_cg")) -> table ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.