Using this R function I am able to see the matching ratio for row clusters:
# Matching ratio function
match_ratio <- function(x)
cbind(x, match_ratio = rowMeans(mapply(`==`, x[1, -1], x[, -1])))
I would like to also label each cell value as True if they match in the row clusters and False if they do not. Any suggestions? Thanks.
Sample input is
ID Var1 Var2
1 East Juice
1 East Soda
2 West Apple
2 East Apple
Sample Output would be
ID Var1 Var2
1 True False
1 True False
2 False True
2 False True
So the clusters are based in ID. 1 is a cluster as is 2.