df1 chunk
tconst titleType primaryTitle startYear endYear runtimeMinutes genres
<chr> <chr> <chr> <dbl> <chr> <chr> <chr>
1 tt0000001 short Carmencita 1894 "\\N" 1 Documentary,Short
2 tt0000002 short Le clown et ses chiens 1892 "\\N" 5 Animation,Short
3 tt0000003 short Pauvre Pierrot 1892 "\\N" 4 Animation,Comedy,Romance
4 tt0000004 short Un bon bock 1892 "\\N" 12 Animation,Short
5 tt0000005 short Blacksmith Scene 1893 "\\N" 1 Comedy,Short
6 tt0000006 short Chinese Opium Den 1894 "\\N" 1 Short
df2 chunk
nconst primaryName birthYear deathYear primaryProfession t_1 t_2 t_3 t_4
<chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
1 nm0000001 Fred Astaire 1899 "1987" soundtrack,actor,miscellaneous tt0072308 tt0053137 tt00504… tt00…
2 nm0000002 Lauren Bacall 1924 "2014" actress,soundtrack tt0037382 tt0075213 tt01170… tt00…
3 nm0000003 Brigitte Bardot 1934 "\\N" actress,soundtrack,music_department tt0056404 tt0054452 tt00573… tt00…
4 nm0000004 John Belushi 1949 "1982" actor,soundtrack,writer tt0078723 tt0080455 tt00725… tt00…
5 nm0000005 Ingmar Bergman 1918 "2007" writer,director,actor tt0083922 tt0050976 tt00509… tt00…
6 nm0000006 Ingrid Bergman 1915 "1982" actress,soundtrack,producer tt0036855 tt0038787 tt00381… tt00…
How can I merge the first df with the second df based on if df1.tconst consists in any of four columns t_1,t_2,t_3,t_4 in df2??
Df1 has over 1.2m row, df2 has over 12M rows
I separated a string tconst2 in df2, it was separated by comma as i haven't found an answer how to join them if it consists in a string. But know I'm stuck anyway.
I tried
> df2 <- merge(x = movies_ratings_df,y = name_df2,
+ by.x = c("tconst", "tconst","tconst","tconst"),
+ by.y = c("t_1","t_2", "t_3", "t_4"))
Error in merge.data.frame(x = movies_ratings_df, y = name_df2, by.x = c("tconst", :
'by.x' и 'by.y'