xm<-matrix(runif(4 * 7, min= -1, max = 1), 4, 7)
ym<-matrix(runif(4 * 8, min= -1, max = 1), 4, 8)
#input data: XprnSet and xprnSetPair
x1 <- XprnSet(exprs = abs(xm))
x2 <- xprnSetPair(x = xprnSet(exprs = xm), y = xprnSet(exprs = ym))
x3 <- nxprnSetPair(x = xm, y = ym, paired = TRUE)
#functions to apply to every feature of the input data
FUN <- function(x, na.rm, ...){t.test(x = x, na.rm = na.rm,...)$statistic}
absFUN <- function(x, y, na.rm, ...){z<-t.test(x = x, y = y, na.rm = na.rm,...)$statistic;abs(z)}
pFUN <- function(x, y, na.rm, ...){t.test(x = x, y = y, alternative = "greater")$p.value}
z1 <- stat(x = x1, na.rm = TRUE, FUN = FUN)
z2 <- stat(x = x2, na.rm = TRUE, FUN = absFUN)
z3 <- stat(x = x3, na.rm = TRUE, FUN = pFUN)
z4 <- stat(x = xm, y = ym, na.rm = TRUE, FUN = absFUN)
Run the code above in your browser using DataLab