see: Selecting significant cases from a chi-squared test
The model example given in the case above is:
f = function(N=1000){
out <- data.frame("Row" = 1:N
, "Column" = 1:N
, "Chi.Square" = runif(N)
, "df"= sample(N, 1:10, replace=T)
, "p.value" = round(runif(N), 3)
)
return(out)
}
but when I would apply this to my model I would turn this into:
f = function(N=7000){
combos <- combn(ncol(final),2)
adply(combos, 2, function(x) {
test <- chisq.test(final[, x[1]], final[, x[2]])
out <- data.frame("Row" = colnames(final)[x[1]]
, "Column" = colnames(final[x[2]])
, "Chi.Square" = round(test$statistic,3)
, "df"= test$parameter
, "p.value" = round(test$p.value, 3)
)
return(out)
}}
yet R does not see this as a finished command line. Why?