data <- example_textgrid(3) |>
read_textgrid()
data
# With a single tier, we get just that tier with the columns prefixed with
# the tier_name
pivot_textgrid_tiers(data, "utterance")
pivot_textgrid_tiers(data, "words")
# With multiple tiers, intervals in one tier that contain intervals in
# another tier are combined into the same row.
a <- pivot_textgrid_tiers(data, c("utterance", "words"))
cols <- c(
"utterance", "utterance_xmin", "utterance_xmax",
"words", "words_xmin", "words_xmax"
)
a[cols]
a <- pivot_textgrid_tiers(data, c("utterance", "words", "phones"))
cols <- c(cols, "phones", "phones_xmin", "phones_xmax")
a[cols]
Run the code above in your browser using DataLab