The des_scatterplot_matrix
function provides Pearson
correlation (r) for groups of numerical variables in the study data.
These variable groups (expecting to show Pearson correlation) have to be
specified in the cross-item level metadata.
The function provides a table with the list of variables and their
correlation and pairwise correlation plots.
des_scatterplot_matrix(study_data = sd1,
meta_data = "item_level",
label_col = LABEL,
meta_data_cross_item = "cross-item_level")
The function has the following arguments:
To illustrate the output, we use the example synthetic data and metadata that are bundled with the dataquieR package. See the introductory tutorial for instructions on importing these files into R, as well as details on their structure and contents.
prep_load_workbook_like_file("meta_data_v2")
sd1 <- prep_get_data_frame("study_data")
des_scat <- des_scatterplot_matrix(study_data = sd1)
The function generates 3 outputs VariableGroupData
,
VariableGroupTable
, and VariableGroupPlotList
.
The first two (VariableGroupData
and
VariableGroupTable
) are exactly the same in this case, but
used differently in the creation of a report.
Output 1: Summary data frame
The summary data frame is called using
des_scat$VariableGroupData
:
Either as an interactive data.tables
table:
DT::datatable(des_scat$VariableGroupData, escape = FALSE)
Or as a kable
:
VARIABLE_LIST | cors | max_cor | |
---|---|---|---|
Blood pressure checks | SBP_0 | DBP_0 | cor(DBP_0, SBP_0) = 0.7655034 | 0.7655034 |
Output 2: Pairwise correlation plots
The matrix of the Pairwise correlation plots is called using
des_scat$VariableGroupPlotList
:
## Registered S3 method overwritten by 'GGally': method from +.gg ggplot2
## $`Blood pressure checks`
Please ignore the warning error messages about GGally
and the error about argument "i"
, both come from the
package GGally
, and both are pointless.