I have the following tibble with two columns, the first has keywords and the second has any related words to the keyword:
# A tibble: 14 x 2
main_word related
<chr> <chr>
1 car rent car
2 car buy car
3 car mechanic
4 car car rent
5 plane plane ride
6 plane plane ticket
7 plane cheap flights
8 plane book flight
9 plane easyjet
10 plane lufthansa
11 plane british airways
12 plane ryan air
13 plane air france
14 plane fly emirates
I want to create lists with the keywords and their related keywords, I've tried this using the map and keep functions but I get an empty list and I can't figure out how to solve it:
a <- c(unique(data$main_word))
words <- map(a,keep(data$related,data$main_word == a))
but I get this:
[[1]]
NULL
[[2]]
NULL