I have two nested list columns and want to find the elements which are in both.
library(tidyverse)
df <-data.frame(stringsAsFactors=FALSE,
session = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3),
user = c("A", "B", "C", "D", "E", "A", "B", "C", "X", "Y", "R", "S",
"T", "D", "E"))
df <- df %>%
group_by(session) %>%
nest() %>%
mutate(session.before=lag(data))
Unfortunately, my purrr expertise is only slowly growing...
This doesn't work:
df %>%
mutate(users.before=map2(data, session.before, inner_join))
Is it something with purrr::keep()?
Greateful for any hint! Many Thanks!