library(tidyverse)
library(palmerpenguins)
data("pb52", package = "phonTools")
Day 7 notes
in-class
remotes::install_github("jvcasillas/untidydata")
Error: Failed to install 'untidydata' from GitHub:
HTTP error 401.
Bad credentials
Rate limit remaining: 38/60
Rate limit reset at: 2024-09-20 15:57:42 UTC
pb52_wide <- read_csv("https://lin611-2024.github.io/notes/meetings/data/pb52_wide.csv")
tibble(
segment = c("P", "T", "D", "G", "G", "K")
) |>
mutate(
voicing = case_when(
segment %in% c("P", "T", "K") ~ "voiceless",
segment %in% c("B", "D", "G") ~ "voiced"
),
#place =
)
Untidy data
pb52_wide <- read_csv("https://lin611-2024.github.io/notes/meetings/data/pb52_wide.csv")
pb52_wide |>
pivot_longer(
cols = matches("_f"),
names_to = "vowel_formant",
values_to = "hz"
) |>
separate_wider_delim(
vowel_formant,
delim = "_",
names = c("vowel", "formant")
) |>
pivot_wider(
names_from = formant,
values_from = hz
)
Practical
pb52 |>
ggplot(
aes(f2, f1)
)+
geom_point() +
scale_x_reverse()+
scale_y_reverse()+
facet_wrap(~type)+
coord_fixed()
pb52 |>
filter(
speaker == 1
) ->
sp1
pb52 |>
pivot_longer(
cols = f1:f3,
names_to = "formant",
values_to = "value"
) |>
mutate(
.by = speaker,
value = log(value) - mean(log(value))
) |>
pivot_wider(
names_from = formant,
values_from = value
) ->
pb_normed
pb_normed |>
ggplot(
aes(f2, f1)
)+
geom_point()+
scale_x_reverse()+
scale_y_reverse()+
facet_wrap(~type)+
coord_fixed()
Reuse
CC-BY 4.0
Citation
BibTeX citation:
@online{fruehwald2024,
author = {Fruehwald, Josef},
title = {Day 7 Notes},
date = {2024-09-18},
url = {https://lin611-2024.github.io/notes/in-class/2024-09-18_day7.html},
langid = {en}
}
For attribution, please cite this work as:
Fruehwald, Josef. 2024. “Day 7 Notes.” September 18, 2024.
https://lin611-2024.github.io/notes/in-class/2024-09-18_day7.html.