# qmlDay1.R # # R code and notes for first 1.5 hour session of week-long course in # quantitative methods in linguistics, given at the "mini-institute" # after the LSA Summer Meeting, 14-18 July 2008 # # (c) 2008, Mary E. Beckman, Cynthia Clopper, Shari Speer (Ohio State # University, Department of Linguistics) # # "Two small case studies will be covered ..." # # James Hillenbrand, Laura A. Getty, Michael J. Clark, & Kimberlee # Wheeler (1995). Acoustic characteristics of American English vowels. # , 97: 3099-3111. # # Joan Bresnan, Anna Cueni, Tatiana Nikitina, & R. Harald Baayen (2007). # Predicting the dative alternation. In G. Boume, I. Kraemer, & J. Zwarts # (eds.) , pp. 69-94. Amsterdam: # Royal Netherlands Academy of Science. # Start by setting the working directory to the path for each of the two # data sets and reading them into R. setwd("C:/Lx286/Hillenbrand") hill=read.table("vowdata.dat",skip=30,na.strings="0")[,1:7] names(hill)=c("filename","dur","f0","F1","F2","F3","F4") setwd("C:/Lx795Q/quantitativeKAJ/CD") bres=read.table("BresDative.txt",header=TRUE) # R code relevant to talking about "Types of variables" and "Distributions # of nominal variables" ... # Look at the first three rows, to see what's in them. hill[1:3,] bres[1:3,] # Do a summary of bres$real to see how many "PP" and how many "NP" # realizations there were. Also, divide by the row dimension of the # the data frame, to convert to proportions. summary(bres$real) summary(bres$real)/dim(bres)[1] # Make barplots of these. barplot(summary(bres$real)/dim(bres)[1],ylim=c(0,1),xlab="realization", ylab="proportion of realizations of dative as ...") table(bres$real,bres$mod) barplot(table(bres$real,bres$mod),beside=TRUE)