I have this sample dataset:
structure(list(Title = c("Isn't It Romantic", "Isn't It Romantic",
"Isn't It Romantic", "Isn't It Romantic", "Isn't It Romantic",
"Isn't It Romantic", "Gully Boy", "Gully Boy", "Gully Boy", "Gully Boy",
"Gully Boy", "Gully Boy", "The Wandering Earth", "The Wandering Earth",
"The Wandering Earth", "The Wandering Earth", "The Wandering Earth",
"The Wandering Earth", "How to Train Your Dragon: The Hidden World",
"How to Train Your Dragon: The Hidden World", "How to Train Your Dragon: The Hidden World",
"How to Train Your Dragon: The Hidden World", "How to Train Your Dragon: The Hidden World",
"How to Train Your Dragon: The Hidden World", "American Woman",
"American Woman", "Us", "Us", "Us", "Us", "Us", "Us", "The Wolf's Call",
"The Wolf's Call", "Avengers: Endgame", "Avengers: Endgame",
"Avengers: Endgame", "Avengers: Endgame", "Avengers: Endgame",
"Avengers: Endgame", "The Silence", "The Silence", "The Silence",
"The Silence", "The Silence", "The Silence", "My Little Pony: Equestria Girls: Spring Breakdown",
"My Little Pony: Equestria Girls: Spring Breakdown"), Ratings = c("Internet Movie Database",
"5.9/10", "Rotten Tomatoes", "68%", "Metacritic", "60/100", "Internet Movie Database",
"8.4/10", "Rotten Tomatoes", "100%", "Metacritic", "65/100",
"Internet Movie Database", "6.4/10", "Rotten Tomatoes", "74%",
"Metacritic", "62/100", "Internet Movie Database", "7.6/10",
"Rotten Tomatoes", "91%", "Metacritic", "71/100", "Rotten Tomatoes",
"57%", "Internet Movie Database", "7.1/10", "Rotten Tomatoes",
"94%", "Metacritic", "81/100", "Internet Movie Database", "7.6/10",
"Internet Movie Database", "8.7/10", "Rotten Tomatoes", "94%",
"Metacritic", "78/100", "Internet Movie Database", "5.2/10",
"Rotten Tomatoes", "23%", "Metacritic", "25/100", "Internet Movie Database",
"7.7/10")), row.names = c(NA, -48L), class = c("tbl_df", "tbl",
"data.frame"))
The Ratings column has 3 different types of Ratings (Imdb, Rotten Tomatoes and Metacritic) for each movie, spread out over 6 rows for each movie.
I'd like to wrangle this dataset so that for each movie, I create a new column called rottentomatoes_rating and the values are the rating. So, in my sample dataset, Isn't it Romantic movie would have 68% under rottentomatoes_rating, Gully Boy would have 100% under rottentomatoes_rating, etc.
For those movies that don't have a rottentomatoes_rating, then I'd like to put NA under rottentomatoes_rating.
I've thought about using spread in tidyr, but I can't quite figure out how to do so since in my case, the variable and values are all in the same column!
