I have asked the very same question here and got a nice answer for dplyr but now I want to do the same on sparklyr.
So I have a spark dataframe where one of the columns contains vectors/lists. I'd like to create a column that contain the element of the vector with index i (an exterior variable).
e.g. with i = 2
In dplyr the solution is:
data <- data %>%
mutate(element = sapply(list_x, "[", i))
But this doesn't work in sparklyr as sapply
doesn't exist in sparklyr.