Skip to content

Instantly share code, notes, and snippets.

@sriyoda
Last active February 1, 2016 00:11
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save sriyoda/ce9de8a499d00027f720 to your computer and use it in GitHub Desktop.
Variable Cleaning
# extract year as separate row
a$year <- str_sub(a$title, -5,-2)
a$title <- str_sub(a$title, 1, -8)
# extract main genre
a$genre <- sapply(a$genres, function(x) unlist(str_split(x, "[|]"))[1])
a$genres = NULL
imdb1 <- left_join(b,a, by="movieId")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment