with 140 more rowsĪnother strategy would be to read the textgrid dataframes into a list Library(dplyr) # This tells read_textgrid() to set the file column to the full path data % mutate( # basename() removes the folder part from a path, # dirname() removes the file part from a path speaker = basename( dirname(file)), file = basename(file), ) %>% select( speaker, everything() ) data #> # A tibble: 150 x 11 #> speaker file tier_num tier_name tier_type tier_xmin tier_xmax #> #> 1 speaker001 s2T01.TextGrid 1 words IntervalTier 0 1.35 #> 2 speaker001 s2T01.TextGrid 1 words IntervalTier 0 1.35 #> 3 speaker001 s2T01.TextGrid 1 words IntervalTier 0 1.35 #> 4 speaker001 s2T01.TextGrid 1 words IntervalTier 0 1.35 #> 5 speaker001 s2T01.TextGrid 2 phones IntervalTier 0 1.35 #> 6 speaker001 s2T01.TextGrid 2 phones IntervalTier 0 1.35 #> 7 speaker001 s2T01.TextGrid 2 phones IntervalTier 0 1.35 #> 8 speaker001 s2T01.TextGrid 2 phones IntervalTier 0 1.35 #> 9 speaker001 s2T01.TextGrid 2 phones IntervalTier 0 1.35 #> 10 speaker001 s2T01.TextGrid 2 phones IntervalTier 0 1.35 #> xmin xmax text annotation_num #> #> 1 0 0.297 "" 1 #> 2 0.297 0.522 "bird" 2 #> 3 0.522 0.972 "house" 3 #> 4 0.972 1.35 "" 4 #> 5 0 0.297 "sil" 1 #> 6 0.297 0.36 "B" 2 #> 7 0.36 0.495 "ER1" 3 #> 8 0.495 0.522 "D" 4 #> 9 0.522 0.621 "HH" 5 #> 10 0.621 0.783 "AW1" 6 #> #. Manipulation to add the speaker information. We can use purrr::map2_dfr() and some dataframe Speaker_data bundled with it representing 5 five textgridsįirst, we create a set of paths to read into R. As an example, this package has a folder called Suppose you have data on multiple speakers with one folder of
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |