View source: R/checkDataFormat.R
checkDataFormat | R Documentation |
This is a function to check the format of meta-analysis data with class data.frame
for its further applicability to the expandMultiarmTrials
function.
checkDataFormat(data, must.contain = c("study", "condition", "Cond_spec", "is.multiarm", "no.arms", "multiple_arms", "Outc_measure", "Time", "primary", "Time_weeks", "sr_clinician"), variable.contains = list("condition" = c("ig", "cg"), "is.multiarm" = c(0,1)), variable.class = list("study" = "character", "condition" = "character", "Cond_spec" = "character", "is.multiarm" = "numeric", "no.arms" = "numeric", "multiple_arms" = "character", "primary" = "numeric", "Time" = "character", "Time_weeks" = "character", "sr_clinician" = "character", "Post_M" = "numeric", "Post_SD" = "numeric", "Post_N" = "numeric", "Rand_N" = "numeric", "Improved_N" = "numeric", "Change_m" = "numeric", "Change_SD" = "numeric", "Change_N" = "numeric"), groups.column.indicator = c("_trt1", "_trt2"), data.format = NULL)
data |
Meta-analysis data stored as a data.frame. |
must.contain |
|
variable.contains |
|
variable.class |
|
groups.column.indicator |
|
data.format |
|
The function ckecks if:
the data set contains all relevant variables
variables contain desired values only and
variables are of desired type (if not, it tries to convert them).
If the dataset format is wide, please specify all variable/column names
without the group indicator suffix (e.g. for "Cond_spec_trt1"
and
"Cond_spec_trt2"
, simply use "Cond_spec"
).
checkDataFormat
returns messages that specify if input variables, values and classes of the variables are as defined.
Mathias Harrer mathias.h.harrer@gmail.com, Paula Kuper paula.r.kuper@gmail.com, Pim Cuijpers p.cuijpers@vu.nl
expandMultiarmTrials
## Not run: data("inpatients") # Example 1: Check data with default arguments checkDataFormat(inpatients) #Example 2: Check for specified variables and corresponding values and classes checkDataFormat(inpatients, must.contain = c("study", "condition", "primary", "year"), variable.contains = list("condition" = c("ig","cg")), variable.class = list(study = "character", no.arms = "numeric")) #Example 3: Convert variable class as predefined checkDataFormat(inpatients, must.contain = c("primary", "study"), variable.class = list(primary = "integer")) #Example 4: Wide format data("psyCtrSubsetWide") checkDataFormat(psyCtrSubsetWide) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.