I have a list of lists like the following:
testlist <- list( list(aaa_x = 1, aaa_y = 2, aaa_z = 5, bbb_a = 333, bbb_b = 222), list(aaa_x = 7, aaa_y = 5, aaa_z = 6, bbb_a = 3939, bbb_b = 5635) )
I want to filter the lists contained in the list (actually, I want to split the list) on condition of name prefixes, so I thought of doing it this way:
testlist %>% map(keep(grepl(pattern="aaa", x=names(.))))
However, I end up with
Error in probe(.x, .p, ...) : argument ".p" is missing, with no default
while the following works (but is of course not sufficient):
testlist[] %>% keep(grepl(pattern="aaa", x=names(.)))
There's probably a very nice, simple, tidy way to do it...
Thanks in advance!