Multiple values for one column

You can use tidyr::separate_rows() see this example

library(tidyverse)

sample_data <- data.frame(stringsAsFactors = FALSE,
                          genres = c("Action|Adventure|Science Fiction|Thriller", "Action|Crime|Thriller"),
                          vote_average = c(6.5, 7.1))

sample_data %>% 
    separate_rows(genres)
#>      genres vote_average
#> 1    Action          6.5
#> 2 Adventure          6.5
#> 3   Science          6.5
#> 4   Fiction          6.5
#> 5  Thriller          6.5
#> 6    Action          7.1
#> 7     Crime          7.1
#> 8  Thriller          7.1

Created on 2019-12-29 by the reprex package (v0.3.0.9000)

If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.

6 Likes