Skip to content
Prev 306522 / 398506 Next

Crosstable-like analysis (ks test) of dataframe

Hello,

Try the following.


f <- function(x, y, ...,
         alternative = c("two.sided", "less", "greater"), exact = NULL){
     #w <- getOption("warn")
     #options(warn = -1)  # ignore warnings
     p <- ks.test(x, y, ..., alternative = alternative, exact = 
exact)$p.value
     #options(warn = w)
     p
}

n <- 1e1
dat <- data.frame(X=rnorm(n), Y=runif(n), Z=rchisq(n, df=3))

apply(dat, 2, function(x) apply(dat, 2, function(y) f(x, y)))

Hope this helps,

Rui Barradas
Em 28-09-2012 11:10, Johannes Radinger escreveu: