# Load required packages and data
library(dplyr)
data(survey_data)
# Basic Mann-Whitney test (non-parametric comparison)
survey_data %>%
mann_whitney(age, group = gender)
# Multiple variables
survey_data %>%
mann_whitney(age, income, life_satisfaction, group = region)
# Using tidyselect helpers
survey_data %>%
mann_whitney(starts_with("trust_"), group = gender)
# Weighted analysis
survey_data %>%
mann_whitney(income, group = region, weights = sampling_weight)
# Grouped analysis (separate tests for each education level)
survey_data %>%
group_by(education) %>%
mann_whitney(life_satisfaction, group = gender)
# One-sided test
survey_data %>%
mann_whitney(life_satisfaction, group = region, alternative = "greater")
# --- Three-layer output ---
result <- survey_data %>%
mann_whitney(income, group = gender, weights = sampling_weight)
result # compact one-line overview
summary(result) # full detailed output with all sections
summary(result, effect_sizes = FALSE) # hide effect sizes
Run the code above in your browser using DataLab