Interactive Descriptive Statistics Homework Checker

Description

Creates a tinytable::tt() table with fill-in-the-blank and multiple choice inputs for checking descriptive statistics results. Requires the tinytable and webexercises packages.

Usage

create_descriptives_checker(
  vars,
  desc_results_list,
  var_labels = NULL,
  label = NULL,
  quantitative = NULL,
  binary = NULL,
  multi_category = NULL
)

Arguments

vars Character vector. Variable names to include, in display order.
desc_results_list Output from descriptives_answers() (a list with $Descriptives). Also accepts a raw tibble from univariate_stats_answers() for backwards compatibility.
var_labels Named character vector or NULL. Optional display labels, e.g. c(clark_height_in = “Clark Height”).
label Character vector or NULL. Variables that are IDs/labels (mean is NOT interpretable).
quantitative Character vector or NULL. Continuous variables (mean IS interpretable).
binary Character vector or NULL. Dichotomous variables (mean IS interpretable).
multi_category Character vector or NULL. Nominal variables with 3+ levels (mean is NOT interpretable).

Value

A tinytable object with embedded webexercise elements.

See Also

descriptives_answers(), univariate_stats_answers()

Examples

library("psych350lab")

data(superman, package = "psych350data")
library(dplyr)

my_data <- superman |>
  select(year, clark_height_in, height_diff) |>
  filter(!is.na(height_diff))

result <- descriptives_answers(my_data,
  vars = c("year", "clark_height_in", "height_diff"))
create_descriptives_checker(
  vars = c("year", "clark_height_in", "height_diff"),
  desc_results_list = result,
  quantitative = c("clark_height_in", "height_diff"),
  label = "year"
)