# Example Jonathan Harrington library(emu) h.s=emu.query("xyz", "*", "phonetic=H") duration=dur(h.s) lab=substring(utt(h.s), 1, 1) boxplot(duration ~ lab) # save picture as png, in R console or R script png(filename=file.path(pfad, "test.png")) #plotting into file boxplot(duration ~ lab) #turning off plotting into file (so plot will pop-up again) dev.off() # WebMAUS database library(emu) webmaus.s=emu.query("webMAUS", "*", "phonetic=H") duration=dur(webmaus.s) #getting just the labels, no segments, maybe less confusing wordLabels=emu.requery(webmaus.s, "phonetic", "word", justlabels=T) ######## long version #getting first characters from labels (upper and lower case) firstLetter = substring(wordLabels, 1,1) #overwriting variable with all lower letters firstLetter = tolower(firstLetter) #getting durations from webmaus duration = dur(webmaus.s) #getting durations from webmaus utterances = utt(webmaus.s) #putting everything into the data frame webmaus.df=data.frame(word=wordLabels, first=firstLetter, dur=duration, utt=utterances) head(webmaus.df) ######### short version webmaus.df=data.frame(word=wordLabels, first=tolower(substring(wordLabels, 1,1)), dur=dur(webmaus.s), utt=utt(webmaus.s)) head(webmaus.df) ######### plot boxplot(webmaus.df$dur ~ webmaus.df$first) #Example tolower test=c("TeSt", "HalLo") tolower(test)