I’m looking for an R package or function that I can use to measure the relative homogeneity/heterogeneity of groups of character strings. There are about 50 groups, each with thousands of character strings, with each string consisting of one or two characters. There are about 100 possible character strings, and not all character strings appear in all groups. A much-abbreviated example:
group1 <- c("AA", "N", "W", "AJ", "KC", "KB", "KB")
group2 <- c("N", "W", "W", "N", "N", "N", "W", "W", "N")
group3 <- c("WA", "W", "W", "AA", "KC", "W")
Group 2 is obviously the most homogenous/least heterogenous. What's an R package or function I can use to quantify this, such that it would produce an index score for each group?