Created
September 20, 2014 12:32
-
-
Save drammock/c4371f27e11f3c8c8e30 to your computer and use it in GitHub Desktop.
phonR snippet for 1S2D
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(phonR) | |
# if you want to go straight to PDF, uncomment this line, and the "dev.off()" line at the end: | |
# cairo_pdf("myfile.pdf", width=6, height=6, pointsize=12) | |
# assuming that your dataframe is called "mydata": | |
# first, create columns for the normalized data: | |
z <- with(mydata, norm.vowels("lobanov", f1=f1, f2=f2, f3=f3, group=speaker)) | |
colnames(z) <- paste(colnames(z), "z", sep="") | |
mydata <- cbind(mydata, z) | |
# now create an interaction column | |
mydata$group <- with(mydata, interaction(age, gender)) | |
with(mydata, plot.vowels(f1z, f2z, vowel, group=group, ellipse.line=TRUE, | |
poly.line=TRUE, poly.order=c("i", "e", "a", "o", "u"), | |
plot.tokens=FALSE, plot.means=TRUE, | |
pch.means=name_vowel, col.by=age, style.by=gender, | |
pretty=TRUE, xlim=c(3, -3), ylim=c(3.5, -2))) | |
# now plot the tokens for just the "CAT" vowel: | |
with(mydata[mydata$name_vowel %in% "CAT",], | |
points(f2z, f1z, pch=20, col=hcl(72, 60, 60, 0.05))) | |
# dev.off() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment