Hi all, R novice here:
Trying to use this code to analyze results from an open card sort:
compare < - function(x1, x2) {
x3 <- x1 + x2
ints <- sum(x3 > 1)
uno < - sum(x3 > 0)
return (ints / uno)
}
getJaccard < - function(data) {
l = length(data[1,])
jmatrix <- matrix(nrow=l,ncol=l)
for (i in 1:l) {
for (j in i:l) {
s <- compare(data[i], data[,j])
jmatrix[i,j] <- s
jmatrix[j,i] <- s
}
}
return (jmatrix)
}
cardsort <- function(filename, blocks) {
filedata <- read.table(filename, header=T, sep=",")
data <- getJaccard(filedata)
colnames(data) <- colnames(filedata)
hc <- hclust(dist(t(data)), method="ward")
hc$labels <- colnames(data)
plot(hc, main = Sys.time())
rect.hclust(hc, k=blocks, border="red")
}
I've installed the jaccard package. I'm getting an error that says -- Error: package or namespace load failed for ‘jaccard’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘qvalue’
I've searched the packages for qvalue and can't find it. Any help?