How to run a t-test for two groups with one group including only one value?
Example:
group A: 7, 8, 9
group B: 5
How to run a t-test for two groups with one group including only one value?
Example:
group A: 7, 8, 9
group B: 5
No, your suggested code is quite wrong.
The fact that there is only one observation for group B is not a problem for the standard two-sample t-test. You just run it in R in the usual way:
A <- c(7,8,9)
B <- 5
t.test(A, B, var.equal=TRUE)
The option var.equal=TRUE tells t.test() to perform the traditional two-sample t-test with pooled variance. In this case, the population variance is estimated from group A alone since replicates for group B are not available. The t-test will be on 2 degrees of freedom.