Hi, thank you for the reply. I'm not sure if this is what you're asking for, but I've copied and pasted the first 90 lines of code deleting most of the text.
{r global_options, include=FALSE}
knitr::opts_chunk$set(fig.height=3)
{r setup, echo=FALSE,message=FALSE}
## Do not delete this!
## It loads the s20x library for you. If you delete it
## your document may not compile
library(s20x)
## Read in and inspect the data:
{r,fig.height=4.2,fig.width=6}
Galton.df=read.csv("Galton3.csv", header=T)
hist(Galton.df$Height)
summary(Galton.df$Height)
# t-statistic for H0: mu=70 :
n=length(Galton.df$Height)
SE=(sd(Galton.df$Height)/sqrt(n))
tstat=(mean(Galton.df$Height)-70)/SE = -13.5137
# 95% confidence interval for the mean:
tmult= qt(1-.05/2, df=n-1)
mean(Galton.df$Height) - tmult*SE = 66.32253
mean(Galton.df$Height) + tmult*SE = 67.25919
CI = (66.32253 67.25919)
## Repeat the same calculation using the t.test function (done for you):
{r}
t.test(Galton.df$Height, mu=70)
I'm working with two datasets, please let me know if you need the second outputted using the dput function.
structure(list(Height = c(73.2, 73.5, 68, 68.5, 68, 69.5, 73,
66, 66, 65.5, 68, 65, 67, 66.69999695, 66.5, 71.5, 66, 62.70000076,
70, 68.5, 67, 66, 65.5, 66, 70.5, 67, 63, 67.5, 64, 70, 74, 68,
65.69999695, 74, 73.19999695, 67, 66, 71, 66, 70.5, 72, 73, 68.5,
62, 68, 70.5, 68, 70, 64.5, 66, 65, 70, 61.5, 70.5, 64, 64.5,
62, 71.5, 70, 66, 75, 66, 67.5, 66, 68.5, 65, 64.5, 65, 70, 62,
65, 69, 66.5, 67, 66.69999695, 70, 65, 60, 65, 69.5, 67, 69,
67.5, 63.70000076, 66.5, 72, 69.19999695, 72, 67, 64.5, 65, 64.5,
66, 71, 64, 65, 70, 72, 63, 61)), row.names = c(NA, 100L), class = "data.frame")
Thank you for taking the time to reply, I'm hoping what I've done is enough.