I wrote my own function. It creates a matrix in which all nominal variables are checked against each other. It can also save the results as an excel file. It displays all pvalues ββthat are less than 5%.
funMassChi <- function (x,delFirst=0,xlsxpath=FALSE) { options(scipen = 999) start <- (delFirst+1) ds <- x[,start:ncol(x)] cATeND <- ncol(ds) catID <- 1:cATeND resMat <- ds[1:cATeND,1:(cATeND-1)] resMat[,] <- NA for(nCc in 1:(length(catID)-1)){ for(nDc in (nCc+1):length(catID)){ tryCatch({ chiRes <- chisq.test(ds[,catID[nCc]],ds[,catID[nDc]]) resMat[nDc,nCc]<- chiRes[[3]] }, error=function(e){cat(paste("ERROR :","at",nCc,nDc, sep=" "),conditionMessage(e), "\n")}) } } resMat[resMat > 0.05] <- "" Ergebnis <- cbind(CatNames=names(ds),resMat) Ergebnis <<- Ergebnis[-1,] if (!(xlsxpath==FALSE)) { write.xlsx(x = Ergebnis, file = paste(xlsxpath,"ALLChi-",Sys.Date(),".xlsx",sep=""), sheetName = "Tabelle1", row.names = FALSE) } } funMassChi(categorialDATA,delFirst=3,xlsxpath="C:/folder1/folder2/")
delFirst can delete the first n columns. Therefore, if you have an account index or something that you do not want to test.
I hope this can help anyone.
source share