I am currently analyzing this dataset using R: https://www.kaggle.com/datasets/arnabchaki/goodreads-best-books-ever
I want to count which genres are the most occurring ones in this dataset. How do I do this, as genres is a string variable that contains multiple genres in this format: ['Religion', 'Nonfiction', 'Philosophy', 'Spirituality', 'Psychology', 'Theology', 'Cults', 'Self Help', 'Horror', 'Pseudoscience']
. How can I transform this variable so that I can calculate the number of times each single genre occurred? Thanks in advance!
I tried:
df %>%
count(genres) %>%
arrange(desc(n))
But this will only calculate how many times a specific order of genres occurred, or it will only work if the genres variable contains a single genre.