# Looking for R package or function to quantify heterogeneity/homogeneity of groups of character strings [closed]

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?

• I see you posted the question on Reddit and got what I believe is a correct answer. Here, we focus on the statistical concepts, and not on programming. Had you omitted references to R in the question, I think this question wouldn't have been flagged for closure. However, perhaps the folks who voted to close could have read the question more generally. – Weiwen Ng Oct 28 '19 at 16:58
• In any case, if you edit the software references out of the question, it will be on topic and it will get re-opened (and bumped back to the top). I can write an answer that names the statistical concept I think is relevant, and that would probably be constructive to debate. You could then go Google how to do that in R (or the code was given on Reddit, anyway). Do note that the vote to close the question is not meant personally. This is a very focused site, so it's pretty different from Reddit or other fora. – Weiwen Ng Oct 28 '19 at 18:53
• Thanks. I'm comfortable letting the question stand as it currently appears, so future users will be forewarned that reasonable questions about how to implement statistical concepts will construed according to the most uncharitable interpretation possible by the site's moderators, and that those seeking practical advice are best advised to ask elsewhere. – LaissezPasser Oct 28 '19 at 19:33
• That is not the message we wanted to convey at all! The question can easily be changed such that it is on topic for the site. Moreover, the FAQ did state pretty clearly that questions solely or mainly about statistical software are off topic. Had you merely asked if there was a statistical concept applicable to your problem, the question would have been clearly on topic. – Weiwen Ng Oct 28 '19 at 19:49