Good afternoon!
Thanks for your advice and helpful comments. I was able to get the data in long format as shown above. I used the following code to achieve it.
selected_data <- select (movie_renamed,movie_title,action,adventure,thriller,scifi,fantasy,
documentary,romance,comedy,animation,family,drama,horror)
melted_data <- melt(selected_data,"movie_title")
melted_data_filtered <- melted_data %>% filter(value=='TRUE')
And I obtain the following data.
movie_data = tibble(movie_title=c("Avatar","Spectre","Avatar"),genre=c("action","fantasy","scifi"))
tibble: 3 × 2
movie_title genre
<chr> <chr>
1 Avatar action
2 Spectre fantasy
3 Avatar scifi
But my goal is to avoid repetition of movie title and have a concatenated list of the genre, for example;
Avatar scifi+action
In other words, we need to go back to wide format with two columns, movie_title and genre. Can I kindly get help here? thanks