@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): Image
@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!

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Christian Gebhard

Christian Gebhard Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(