I have two data frames:
1:
# A tibble: 6 x 8
Name `Legislative period` Notes Username Chamber Country Party TwitterID
<chr> <chr> <chr> <lgl> <chr> <chr> <chr> <lgl>
1 Sanae Abdi 26/10/2021 - today NA NA Bundestag Germany SPD NA
2 Valentin Abel 26/10/2021 - today NA NA Bundestag Germany FDP NA
3 Knut Abraham 26/10/2021 - today NA NA Bundestag Germany CDU NA
4 Katja Adler 26/10/2021 - today NA NA Bundestag Germany FDP NA
5 Stephanie Aeffner 26/10/2021 - today NA NA Bundestag Germany GRÜNE NA
6 Adis Ahmetovic 26/10/2021 - today NA NA Bundestag Germany SPD NA
and 2:
# A tibble: 6 x 6
Name screen_name1 screen_name2 user_id1 user_id2 party
<chr> <chr> <chr> <dbl> <dbl> <chr>
1 "Sanae Abdi" _sanaeabdi NA 2.01e 8 NA SPD
2 "Valentin Christian Abel" valentin_c_abel NA 1.70e 9 NA FDP
3 "Urs Jakob Abelein" NA NA NA NA SPD
4 "J\xfcrgen Abelmann" NA NA NA NA DIE LINKE
5 "Carolin Abeln" NA NA NA NA FDP
6 "Ernst Michael Abercron" mvabercron NA 8.63e17 NA CDU
I want to add the "screen_name1" to "Username" in data frame 1 whenever "Name" matches between the two data frames. "screen_name1" should of course be positioned at the same row as the matching name.
I do NOT want to use inner_join since it will delete the rows not matching up.
I've been playing around with an ifelse statement without much luck:
allPoliticians_df$Username <- (ifelse(allPoliticians_df$Name %in% unlist(combined_df) == TRUE, twitter2021Election_df$screen_name1, NA))
Any help is greatly appreciated!