## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## ----------------------------------------------------------------------------- library(phontrast) set.seed(2026) vowels <- data.frame( speaker = rep(c("s01", "s02"), each = 60), vowel = rep(rep(c("ih", "eh"), each = 30), 2), f1 = c( rnorm(30, 500, 55), rnorm(30, 560, 60), rnorm(30, 510, 60), rnorm(30, 575, 65) ), f2 = c( rnorm(30, 1980, 150), rnorm(30, 1880, 155), rnorm(30, 1960, 160), rnorm(30, 1840, 165) ) ) ## ----------------------------------------------------------------------------- metrics_wide <- phontrast( data = vowels, features = c("f1", "f2"), category_col = "vowel", group_col = "speaker", output = "wide" ) metrics_wide ## ----------------------------------------------------------------------------- metrics_long <- phontrast( data = vowels, features = c("f1", "f2"), category_col = "vowel", group_col = "speaker", output = "long" ) metrics_long[, c("group", "metric", "estimate", "orientation", "separation_value")] ## ----eval = requireNamespace("ggplot2", quietly = TRUE)----------------------- plot_category_space( data = vowels, features = c("f2", "f1"), category_col = "vowel", group_col = "speaker", reverse_x = TRUE, reverse_y = TRUE ) plot_overlap_metrics(metrics_long) ## ----eval = FALSE------------------------------------------------------------- # phontrast( # data = vowels, # features = c("f1", "f2"), # category_col = "vowel", # group_col = "speaker", # do_boot = TRUE, # n_boot = 1000, # output = "long" # )