remover items from lists based on presence of a sub-list

We can create a condition with sapply (from base R)

dat[!sapply(dat, is.list)]

Or with Filter from base R

Filter(Negate(is.list), dat)

Or with discard

library(purrr)
discard(dat, is.list)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top