With regards to t-test, the function t.test() in R may be used. This is a rather simple function which performs both one- and two-sample t-tests (it is thus likely that we will meet that function elsewhere in this website).

Assuming that you have stored your sample data in the variable called scores, the command to use is t.test(scores, alternative="ALT", mu = Y) where:

Using our previous example, this looks like:

t.test(scores, alternative="greater", mu=120)
## 
##  One Sample t-test
## 
## data:  scores
## t = 3.9591, df = 39, p-value = 0.0001547
## alternative hypothesis: true mean is greater than 120
## 95 percent confidence interval:
##  123.6476      Inf
## sample estimates:
## mean of x 
##    126.35

R returns several lines of text. One of them provides a p-value while the next line states the alternative hypothesis which depends on the parameter alternative that you have entered in the t.test(). This alternative hypothesis Ha is considered valid when the p-value is less than 0.05.

Read more about t.test() and find more options by clicking here or there or by simply typing ?t.test in the R console.