myNhanes <- read.delim("http://myweb.uiowa.edu/pbreheny/161/data/trg-adultwomen.txt")

attach(MyNhanes)
t.test(TRG)

#changing the confidence level to 90%
t.test(TRG, conf.level=.9)

#testing the hypothesis that TRG = 120
t.test(TRG, mu = 120)

detach(MyNhanes)

cf <- read.delim("http://myweb.uiowa.edu/pbreheny/161/data/cysticfibrosis.txt")

attach(cf)

#t-test on difference between drug and placebo
t.test(Drug,Placebo,paired=TRUE)
t.test(Drug-Placebo)     # Same thing

#probabilities for the t-distribution
pt(1.96,5)
pt(1.96,50)
pt(1.96,500)

#quantiles for the t-distribution
qt(.975,5)
qt(.975,50)
qt(.975,500)