Hi, I've been wondering how to write a function that will produce results from multiple tests (eg. paired t-tests) for all or several variables in some data frame. I'd like it to do t-test for each variable ('x') in 'data' by 'y'. I'm stuck in here:
function(data,y) { for (x in names(data)) { with(data, t.test(x~y)) }} How to tell 'with' that 'x' and 'y' are names of columns in 'data'? Or pass similar arguments? I probably understand the logic why this is not working, but still don't know how to make it work. Thanks in advance for any help! Timo ______________________________________________ R-help@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.