Hi, Try this: set.seed(24) b1<- sample(1:40,20,replace=TRUE) set.seed(28) a1<- sample(30:50,20,replace=TRUE) t_test_apparie <- function(x,y) { t.test(x,y,paired=TRUE,alternative = "greater")$p.value }
t_test_apparie(a1,b1) #[1] 6.571404e-08 A.K. >Hi, > >I have written this function : > >t_test_apparie <- function(x,y) >{ >t.test(x,y,paired=TRUE,alternative = "greater") >} > >I would like that ONLY the p-value gets returned. How would I do that? > >Thanks. ______________________________________________ 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.