I am using R and have a data frame as such
Record_Num STR
1 ABC
1 ABC
1 EFG
2 HIJ
2 HIJ
2 KLM
3 KLM
3 KLM
3 KLM
I am attempting to get a count for each STR for each record number, so something like this:
Record_Num STR Count
1 ABC 2
1 EFG 1
2 HIJ 2
2 KLM 1
3 KLM 3
If I can get that I can take the steps to get what I need, but my next step is to simply weed out the max count for each STR (which I will then use to create a loop - I'm trying to tidy up some very messy data). If I can incorporate that into a single step, all the better, but I'm not concerned about that. I just can't seem to solve the above problem. Given that I'm an extreme novice. I've toyed around with table and tapply, but haven't been able to get it right. Can anybody help?
I realize this is very basic for most of you, so sorry for such a novice question.