1

I have a list that is produced by the combinations of the elements of three other lists (in this example I will use vectors) through the cross3() command of purrr.

 a<- cross3(5:1,1:25,1:5)

I only need the combinations that will be on specific positions, say 1, 45, 203 of the resulting list.

Currently, I do this through an additional command

a<- cross3(5:1,1:25,1:5) %>% `[`(c(1,45,203))

but I was wondering if can save this extra command by using the .filter argument of cross3(). The problem is that the .filter argument needs a function that returns a boolean vector and has as input three arguments (practically the input lists of cross3), so I can not use the positions. I would appreciate a tidyverse solution, since this is part of a bigger workflow.

User800701
  • 159
  • 10

0 Answers0