# load the libraries we need
library(gmodels)
# open and read the data
USCounties<-read.csv("http://www.courseserve.info/files/USCounties.csv")
attach(USCounties)
# calculate a mean test; you have to supply the population mean (mu) test value
# this is also the confidence interval
t.test(PopGr00_05, mu=0)
# we can calculate a confidence interval for a proportion also
# we'll start with a binary variable and test the proportion
# of cases flagged as '1' against a parameter of (pi) 0.5, which
# is what we'd expect due to chance.
prop.test(length(LowEduc04[LowEduc04==1]),length(LowEduc04))
# often, it is not a reasonable test to assume the population parameter
# is 0.5, so we can specify a different p-value
prop.test(length(LowEduc04[LowEduc04==1]),length(LowEduc04),p=0.25)