# Required functions: `srs.mean` and `srs.total` uspop=read.csv("http://webpages.uidaho.edu/~renaes/Data/uspop.csv",header=T) View(uspop) # remove the 1st row since it is for the whole US uspop=uspop[-1,] summary(uspop) # setting the seed will allow you to use the same value from R's rng to get same results set.seed(59373) # install the sampling package with code here or in Packages tab in the bottom right # window of RStudio. Only install once # install.packages("sampling") # load the package with library(), require(), or in Library tab in the bottom right # window of RStudio library(sampling) N=50; n=16 s=srswor(n,N); s srs=(1:N)[s==1], srs uspop.srs=uspop[srs,] View(uspop.srs) srs.mean('uspop.srs',uspop.srs$Y1824,10,92) srs.total('uspop.srs',uspop.srs$Y1824,10,92)