Hi all- I am wondering about using the mapply function to multiple data frames. Specifically, I would like to do a t-test on a subset of multiple data frames. All data frames have the same structure. Here is my code so far:
f<-function(x,y) { test<-t.test(x$col1[x$col3=="num",],v$col2[x$col3=="num",],paired=T,alternative="greater") out<-test$p.value return(out) } all_nums<-list(num1,num2,num3,num4) all_dfs<-list(df1,df2,df3,df4) mapply(f,all_dfs,all_nums) This tells me that $ operator is invalid for atomic vectors. I have tried shifting to notation using [ ,] to denote columns, but that gives me this error: incorrect number of dimensions. Thank you in advance, Elizabeth ______________________________________________ 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.