Skip to content
Prev 138412 / 398506 Next

creating a matrix subset based on a threshold cutoff

You have a table or matrix?

if is matrix:

set.seed(123)
x <- matrix(rnorm(100), 10, 10)
cutoff <- -1.5
do.call(rbind, apply(x, 1, function(.x).x[any(.x < cutoff)]))

On 04/03/2008, rich at thevillas.eclipse.co.uk
<rich at thevillas.eclipse.co.uk> wrote: