I need to find the first element that repeated "N" times, and "N" may change. For example, the elements are:
test <- c("A","B","B","C","A","A","C","C","C")
If N=2, it should return "B".
If N=3, it should return "A".
I have seen similar questions, but I need to only return the first element which repeated "N" times, and then stop. Many thanks.
(I made this example to represent a real work problem in an experimental chemistry study, where we have to find the re-occurrence of something.But the numbers of re-occurrence to be considered always change! Thanks!)