powered by
Split a vector or a list in 2 groups, given a predicate function.
partition(x, predicate)
vector or list to partition.
a function returning a boolean value, to apply to each element of x.
A list of two elements. The first element contains elements of x satisfying the predicate, the second the rest of x. Missing values will be discarded.
# NOT RUN { partition(c(2, 1, 3, 4, 1, 5), function(x) x < 3) partition(list(1:3, NA, c(1, NA, 3)), anyNA) # }
Run the code above in your browser using DataLab