# Process_Extract_Formants_Scripts_Results_Starter_Dec2020.R # R Script accompanying _Sociophonetics_ by Tyler Kendall & Valerie Fridland # Tyler Kendall & Valerie Fridland, 2020 (CC BY 4.0) # # This simple script is meant as a starter for processing some vowel data you might # extract using one of the Extract_Formants... Praat scripts. # # Install the vowels.R library if you do not have it installed already # e.g. > install.packages("vowels", dependencies=T) library(vowels) # Set the path to the file you want to use, this should be created by one of the Praat # scripts from the _Sociophonetics_ website path.to.file <- "~/Documents/YourResults_vowels.txt" # This assumes you have a header row in your file, set header to FALSE if not. input <- read.delim(path.to.file, header=TRUE) # This will trim the spreadsheet for use with Vowels.R/NORM. This version uses # the mid point and glide values, replace 14:16 with 8:10 to use the onset measurement # point instead of the mid point trimd <- input[,c(1, 2, 5, 14:16, 20:23)] # Then you can use the Vowels.R package for plotting, normalizing, etc. the data. E.g.: vowelplot(trimd) # See other scripts on the _Sociophonetics_ website or more plotting examples # And/or write out this trimmed file for uploading to NORM (http://lingtools.uoregon.edu/norm/) new.path.to.file <- gsub("\\.txt", "_trimmed.txt", path.to.file, perl=T) write.table(trimd, new.path.to.file, quote=F, row.names=F)