Displaying 1 result from an estimated 1 matches for "ncolnum".
Did you mean:
colnum
2006 Aug 08
3
Pairwise n for large correlation tables?
...ing other functions to use or ways to maket his speedier, would
be much appreciated!
pairwise.n <- function(df=stop("Must provide data frame!")) {
if (!is.data.frame(df)) {
df <- as.data.frame(df)
}
colNum <- ncol(df)
result <- matrix(data=NA,nrow=colNum,ncol=ncolNum,dimnames=list(colnames(df),colnames(df)))
for(i in 1:colNum) {
for (j in i:colNum) {
result[i,j] <- length(df[!is.na(df[i])&!is.na(df[j])])/colNum
}
}
result
}
--
Adam D. I. Kramer
University of Oregon