Depending on your column selection, different types of plots and tables are generated. See plot_metrics and tab_metrics.
report_metrics(
data,
cols,
cross = NULL,
metric = FALSE,
...,
index = FALSE,
factors = FALSE,
clusters = FALSE,
model = FALSE,
effect = FALSE,
title = TRUE,
close = TRUE,
clean = TRUE
)
A volker report object.
A data frame.
A tidy column selection, e.g. a single column (without quotes) or multiple columns selected by methods such as starts_with().
Optional, a grouping or correlation column (without quotes).
When crossing variables, the cross column parameter can contain categorical or metric values. By default, the cross column selection is treated as categorical data. Set metric to TRUE, to treat it as metric and calculate correlations. Alternatively, for multivariable models (if the model parameter is TRUE), provide the metric column selection in the metric parameter and the categorical column selection in the cross parameter.
Parameters passed to the plot_metrics and tab_metrics and effect_metrics functions.
When the cols contain items on a metric scale (as determined by get_direction), an index will be calculated using the 'psych' package. Set to FALSE to suppress index generation.
The number of factors to calculate. Set to FALSE to suppress factor analysis. Set to TRUE to output a scree plot and automatically choose the number of factors. When the cols contain items on a metric scale (as determined by get_direction), factors will be calculated using the 'psych' package. See add_factors.
The number of clusters to calculate. Cluster are determined using kmeans after scaling the items. Set to FALSE to suppress cluster analysis. Set to TRUE to output a scree plot and automatically choose the number of clusters based on the elbow criterion. See add_clusters.
Set to TRUE for multivariable models. The dependent variable must be provided in the first parameter (cols). Independent categorical variables are provided in the second parameter (cross), which supports tidy column selections or vectors of multiple columns. Independent metric variables are provided in the metric parameter as tidy column selections or vectors of multiple columns. Interaction terms are provided in the interactions parameter and passed to the model functions. You can get diagnostic plots by setting the diagnostics parameter to TRUE. See model_metrics_tab, model_metrics_plot and add_model for further options.
Whether to report statistical tests and effect sizes. See effect_counts for further parameters.
A character providing the heading or TRUE (default) to output a heading. Classes for tabset pills will be added.
Whether to close the last tab (default value TRUE) or to keep it open. Keep it open to add further custom tabs by adding headers on the fifth level in Markdown (e.g. ##### Method).
Prepare data by data_clean.
For item batteries, an index is calculated and reported. When used in combination with the Markdown-template "html_report", the different parts of the report are grouped under a tabsheet selector.
library(volker)
data <- volker::chatgpt
report_metrics(data, sd_age)
Run the code above in your browser using DataLab