[R] multiple t-tests across similar variable names

Rui Barradas ruipbarradas at sapo.pt
Thu Oct 11 03:38:28 CEST 2012


Could you post a data example? Using, with data.frame named 'dat'

dput( head(dat, 30) )  # paste the output of this in a post

I have written code that creates pairs pre/post columns but it can't 
really be tested.

Hope this helps,

Rui Barradas
Em 11-10-2012 00:09, Nundy, Shantanu escreveu:
> Hi everyone-
> I have a dataset with multiple "pre" and "post" variables I want to compare. The variables are named "apple_pre" or "pre_banana" with the corresponding post variables named "apple_post" or "post_banana". The variables are in no particular order.
> apple_pre orange_pre orange_post pre_banana apple_post post_banana
> person_1
> person_2
> person_3
> ...
> person_x
> How do I:
> 1. Run a series of paired t-tests for the apple_pre variables and pre_banana variables? Would be great to do something like ttest(*.*pre*.*,*.*post*.*).
> 2. Print the results from these t-tests in a table with col 1=mean difference, col 2= 95% conf interval, col 3=p-value.
> Thank you kindly,
> -Shantanu
> Shantanu Nundy, M.D.
> University of Chicago
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list