Using str_split and removing duplicate values from the same record in R
Using str_split and removing duplicate values from the same record in R I have a data frame of book genres. It began as two columns, one for the title and one for a character string containing multiple genres, similar to this: titles <- c("Harry Potter 1", "To Kill A Mockingbird", "The Hunger Games 1") genres <- c("Fantasy, Young Adult, Fantasy, Magic", "Classics, Fiction, Historical, Historical Fiction, Academic", "Young Adult, Fiction, Science Fiction, Dystopia, Science Fiction") books <- tibble( title = titles, genre = genres) books # A tibble: 3 x 2 title genre <chr> <chr> 1 Harry Potter 1 Fantasy, Young Adult, Fantasy, Magic 2 To Kill A Mockingbird Classics, Fiction, Historical, Historical Fiction, Academic 3 ...
