install.packages(“rmarkdown”)

# sets wd to the path on my computer; 
setwd("C:\\Users\\hmon1\\Desktop\\10B+Homework\\") #this is where you downloaded the HW1.csv file
# loads in data for the full population
pop<-read.csv("HW10.csv")
# sets the seed for the random number generator
set.seed(48183130)  #use your student ID instead of 12345678
# assigns a "random" sample of 10 from the population to 'data' to fill in your homework
sample<-pop[sample(1:nrow(pop), 10, replace=FALSE),]
sample
##      A  B
## 640 15 16
## 413 18 16
## 871 20 20
## 336 19 24
## 357 18 20
## 238 15 16
## 56  14 16
## 83  17 26
## 351 16 16
## 632 17 26
# finds the difference
sample$d <- sample$B - sample$A
# calculates standard error of the sampling distribution
n <- length(sample$A)
n
## [1] 10
sd <- sd(sample$d)
sd
## [1] 3.772709
SE <- sd/sqrt(n)
SE
## [1] 1.193035
t.test(sample$B,sample$A,paired=TRUE)
## 
##  Paired t-test
## 
## data:  sample$B and sample$A
## t = 2.2631, df = 9, p-value = 0.04992
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  0.00116655 5.39883345
## sample estimates:
## mean of the differences 
##                     2.7