We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1c5d47f commit 83d7e03Copy full SHA for 83d7e03
jaccards.R
@@ -0,0 +1,11 @@
1
+jaccards <- function(list1, list2){
2
+ sapply(list1, function(x){
3
+ jacc <- sapply(list1, function(x) sapply(list2, function(y) length(intersect(x,y))/length(union(x,y))))
4
+ jacclong <- melt(jacc)
5
+ intersects <- sapply(list1, function(x) sapply(list2, function(y) length(intersect(x,y))))
6
+ unions <- sapply(list1, function(x) sapply(list2, function(y) length(union(x,y))))
7
+ len1 <- t(as.data.frame(lapply(list1, length)))
8
+ len2 <- t(as.data.frame(lapply(list2, length)))
9
+ cbind(jacclong, List1=rep(len1, length(len2)), List2=rep(len2, length(len1)), Intersect=melt(intersects)[,3], Union=melt(unions)[,3])
10
+ })
11
+}
0 commit comments