data(cushny)
with(cushny, t.test(drug1,drug2L,paired=TRUE)) #within subjects
psych::error.bars(cushny[1:4],within=TRUE,ylab="Hours of sleep",xlab="Drug condition",
main="95% confidence of within subject effects")
Run the code above in your browser using DataLab