In the file 2022day7.txt, the line:
res$pval<-(1-pt(q=tStat, df = 1887, lower.tail = T))*2
should actually read:
res$pval<-(1-pt(q=res$tStat, df = 1887, lower.tail = T))*2
It wouldn’t run without the res$ in the version I copied to my home dir.