@ParkerKMathias I haven't had the chance to look at the data yet, so these ideas might not be directly applicable, but I'd say that there are at least three ways to approach this, depending on the scope and "error tolerance" of the analysis:
@ParkerKMathias (1) using tidyr::separate() to split a list of authors and then pivot_longer() to count them separately
You could split
|Song 1 | Mariah Carey and So-and-so |
into
|Song 1 | Mariah Carey | So-and-so |
then pivot_longer into
|Song 1 | Mariah Carey |
|Song 1 | So-and-so |
@ParkerKMathias (1) but this would fail in many cases, e.g. where the artists are separated differently, e.g. "Mariah Carey & So-and-so". Also, you have to specify the number of columns to separate into, so if you have more than two artists only the first pair would be separated:
@ParkerKMathias (1) "Mariah Carey and So-and-so and Yet-another"
would result in
|Mariah Carey | So-and-so and Yet-another|
@ParkerKMathias (Approach 2) If you know the most common phrases used to list artists (like "and", "&", "feat.",...): you could use str_split() and a RegEx to split independently of the number of authors (but this might still fail if the authors' names have any of the above in their name):
@ParkerKMathias (Approach 3) If you limit the analysis to a set of artists of interest you could use RegEx to detect these artists within the artist-string. This is basically the inverse solution to approach 2.
@ParkerKMathias (3) The trade-off here is, that you will only find the set of artists you look for, but you will find them independently of how they are connected. So you don't need to think of all possible alternatives such as &/and/a./feat./ft./featuring etc.
@ParkerKMathias (4) Writing the above, I came up with a fourth approach. However this might be way too much trouble to implement: if you generate a dataframe with any distinct artist name in a column, you could use "record linkage" or "string distance matching"...
@ParkerKMathias The last one is probably not the most straight forward approach.
I cannot look into the #TidyTuesday data this week and give you a working code for the actual data, but if you follow one of the approaches and get stuck, let me know. Happy coding!