I know it's easy to write a simple loop to do this, but in the spirit
of lapply, I thought I would ask if there is a builtin to filter or
take a subset of a list based on a predicate in a similar way to the
Erlang lists:filter/2 function:
http://www.erlang.org/doc/man/lists.html#filter-2
Try:
?Filter
e.g.
Filter(function(x) x 0, x1)
or using gsubfn's fn
library(gsubfn)
fn$Filter(~ x 0, x1)
On Wed, Oct 29, 2008 at 9:06 AM, Whit Armstrong
[EMAIL PROTECTED] wrote:
I know it's easy to write a simple loop to do this, but in the spirit
of lapply, I thought I would ask if
?Filter ...
how did I miss that one?
Thanks, Gabor.
-Whit
On Wed, Oct 29, 2008 at 9:37 AM, Gabor Grothendieck
[EMAIL PROTECTED] wrote:
Try:
?Filter
e.g.
Filter(function(x) x 0, x1)
or using gsubfn's fn
library(gsubfn)
fn$Filter(~ x 0, x1)
On Wed, Oct 29, 2008 at 9:06 AM,
3 matches
Mail list logo