How to calculate p-value for t-test if original data is not available? I have two (normally distributed) samples:
First: n=50 mean=3 sd=2
Second: n=40 mean=3.5 sd=1.9
Is this enough to perform two-sample and two-sided Student's t-test with equal variances? If yes, how can I compute p-value in R? Function t.test() accepts only original data.
Thank you in advance.
 A: Yes, you can. Just plug-and-chug these values into the t-test formula. I'm going to assume the samples are independent, and this is an unpaired two-tailed test:
$ t= \frac{\left | \bar{X_1} - \bar{X_2} \right |}{\sqrt{s_1^2 /n_1 + s_2^2 /n_2  }} $
Once you've calculated this t statistic, compare it against the appropriate t-value for the significance level you are testing for at $df = n_1 +n_2 - 2$. At $df = 88$,  $t \geq 1.99$ gives a significance of $p \leq 0.05$ (via this t-table). In your case, $t=1.21$, so your sample means are not significantly different at the $p=0.05$ level.
If you need to calculate the exact p-value, instead of looking it up in a t-table you can use the r function for the $t$ CDF, pt(), which gives $p = 0.2288375$ for your data when you specify that you want the upper tail of the distribution (lower.tail=F) and double your result for a two-tailed test.
Here's the whole thing wrapped in a little function in case you have more similar tests to run: 
homebrew_two_tailed_t_test = function(m1, m2, n1, n2, s1, s2){
  t = abs(m1-m2)/sqrt(s1^2/n1 + s2^2/n2)
  2*pt(t, n1 + n2 -2, lower.tail=F)
}

>homebrew_two_tailed_t_test(3.5, 3, 50, 40, 2, 1.9)
0.2288375

