phonfieldwork (version 0.0.10)

df_to_tier: Dataframe to TextGrid's tier

Description

Convert a dataframe to a Praat TextGrid.

Usage

df_to_tier(df, textgrid, tier_name = "", overwrite = TRUE)

Arguments

df

an R dataframe object that contains columns named "content", "time_start" and "time_end"

textgrid

a character with a filename or path to the TextGrid

tier_name

a vector that contain a name for a created tier

overwrite

a logic argument, if TRUE overwrites the existing TextGrid file

Value

If overwrite is FALSE, then the function returns a vector of strings with a TextGrid. If overwrite is TRUE, then no output.

Examples

Run this code
# NOT RUN {
time_start <- c(0.00000000, 0.01246583, 0.24781914, 0.39552363, 0.51157715)
time_end <- c(0.01246583, 0.24781914, 0.39552363, 0.51157715, 0.65267574)
content <- c("", "T", "E", "S", "T")
df_to_tier(my_df <- data.frame(id = 1:5, time_start, time_end, content),
  system.file("extdata", "test.TextGrid",
    package = "phonfieldwork"
  ),
  overwrite = FALSE
)
# }

Run the code above in your browser using DataLab