##explanations follow each command and result

> summary.aov (aov(datAmE$differencepitchlr ~ datAmE$StructuralRelation))
                           Df  Sum Sq Mean Sq F value  Pr(>F)   
datAmE$StructuralRelation   1   23969   23969  9.1603 0.00263 **
Residuals                 408 1067589    2617                   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 

#gives anova for pitch in hz by structural relation
#argument vs modifier

boxplot(datAmE$differencepitchlr ~ datAmE$StructuralRelation)

#creates boxplot

table1=table(datAmE$stresspit, datAmE$StructuralRelation)

# creates a table object

barplot(sweep(table1, 2, apply(table1, 2, sum), "/"), ylab="percentage", legend.text=TRUE, width=0.1, xlim=c(0,0.5), cex.names=c(0.7))

# creates a barplot from a sweep object. The sweep object contains a table with the percentages #of the coulumns (i.e. '2') of the matrix object created by the 'apply' function from table1. #'width' can manipulate the width of the bars if xlim is specified. 'cex.names' manipulates the #size of the bar labels on the x-axis

boxplot(pitch.diff.ST ~ sex, data=datAmE, ylab="Pitch difference in semitones")

#creates boxplot for sec differences

boxplot(pitch.diff.ST ~ ArgSem, data=datAmE, ylab="Pitch difference in semitones", names=c("argument", "novel mod", "exist. mod"))

#creates boxplot for argument vs modifier 


interaction.plot(mp$relation, mp$cltype, mp$pitch.diff.ST, xlab="semantic relation", ylab="mean of pitch difference", trace.label="clause types", bty="L")

##creates interaction plot. trace.label gives legend header, bty formats box around plot 
##(L=shape) 

boxplot(pitch.diff.ST ~ rightmember, data=novel, ylab="Pitch difference in semitones", cex.lab=c(0.85), las=3)

##creates boxplot with only vertical axis labels and a y-axis label which is .85 smaller than 
##original

boxplot(datAmE$leftpitch[datAmE$position == "initial"], datAmE$rightpitch[datAmE$position == "initial"], datAmE$leftpitch[datAmE$position == "medial"], datAmE$rightpitch[datAmE$position == "medial"], datAmE$leftpitch[datAmE$position == "final"], datAmE$rightpitch[datAmE$position == "final"], ylab="pitch in hz", cex.lab=c(0.85), las=3, names=c("initial-left","initial-right", "medial-left", "medial-right", "final-left", "final-right"), cex.lab=c(0.85), cex.axis=c(0.85), las=3, col=c("lightgrey", "white", "lightgrey", "white","lightgrey", "white"))

#creates grouped boxplot for pitches across sentential positions

* lets do this for pitchdiffeences in ST

boxplot(datAmE$pitch.diff.ST[datAmE$position == "initial"], datAmE$pitch.diff.ST[datAmE$position == "medial"], datAmE$pitch.diff.ST[datAmE$position == "final"], ylab="pitch difference in semitones", cex.lab=c(0.85), las=3, names=c("initial", "medial", "final"), cex.lab=c(0.85), cex.axis=c(0.85), las=3)


