Write your own function in R to perform a t-test (it may not use t.test). The t-test
Question:
Write your own function in R to perform a t-test (it may not use t.test). The t-test should be unpaired and
you may assume that the samples have equal variance. This function must have the following properties:
a. It should be able to do either a one-sample of two sample t-test and should be able to tell which is required
by whether the user gives one or two samples. hint: You can do this using an if-then structure and the
missing() function.
b. The user should be able to specify a choice of alternative hypotheses by giving arguments two-sided,
less, or greater. If no such alternative is given, then the default should be two-sided.
c. The user should be able to specify a parameter mu indicating the true value of the mean or difference in
means under the null hypothesis. If unspecified, the default should be mu=0.
d. The result should be a list with the value of the t-statistic and the p-value with a names attribute specifying
which is which.