Created
March 11, 2011 07:51
-
-
Save GPHemsley/865592 to your computer and use it in GitHub Desktop.
Graph formants from multiple samples of the word "video"
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
# Copyright 2011 Gordon P. Hemsley | |
# Released under CC-BY-SA license | |
# Load data from Google Docs spreadsheet | |
usubs_video_data <- read.csv("http://spreadsheets.google.com/pub?key=0Agx1-YanlF2jdGdhbHdSTDdWcmphNXZEOWlrRENmY1E&single=true&gid=1&output=csv") | |
# Add data to variable space | |
attach(usubs_video_data) | |
# Print summary of our data table | |
print(summary(usubs_video_data)) | |
# Create new variables to exclude samples that aren't strictly "video" | |
Meter4 <- rep(subset(Meter,(Context=="video")),4) | |
F1g <- subset(F1,(Context=="video")) | |
F2g <- subset(F2,(Context=="video")) | |
F3g <- subset(F3,(Context=="video")) | |
F4g <- subset(F4,(Context=="video")) | |
F5g <- subset(F5,(Context=="video")) | |
# Print summary of our formants | |
print(summary(c(F1g,F2g,F3g,F4g))) | |
# Outpit graph to PNG file | |
png(file="./usubs_video_Fall.png",width=800,height=600); | |
# Plot graph of points, all formants on the same graph | |
plot(Meter4,c(F1g,F2g,F3g,F4g),xlim=c(0,1),ylim=c(0,4100),xlab="Meter",ylab="Formants (Hz)",main="Formants of 'video'",pch=20,axes=F,col="red") | |
# Add grid lines | |
abline(v=seq(from=0,to=1,by=0.1),h=seq(from=0,to=4100,by=400),col="lightgray",lty="dotted",lwd=par("lwd")) | |
# Add custom axes | |
axis(1,seq(from=0,to=1,by=0.1),labels=seq(from=0,to=100,by=10)) | |
axis(2,seq(from=0,to=4100,by=800)) | |
# Close our imaging device | |
dev.off() | |
# Clean up our variable space | |
detach(usubs_video_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment