Skip to content
Back to formatted view

Raw Message

Message-ID: <da79af330803040328w3acad997leb59e1209733e61a@mail.gmail.com>
Date: 2008-03-04T11:28:52Z
From: Henrique Dallazuanna
Subject: creating a matrix subset based on a threshold cutoff
In-Reply-To: <6ncd3n$7ru2q7@mercury.eclipse.kcom.com>

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:
>
>    Hi,
>
>     I have a table of x rows and y columns. The table is huge and so i'd like
>    to create a subset of the data containing rows where any of the y values are
>    below a threshold, say 1e-4. Is there a simple way of doing this in R?
>
>
>    thanks
>
>    Rich
>  ______________________________________________
>  R-help at r-project.org mailing list
>  https://stat.ethz.ch/mailman/listinfo/r-help
>  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>  and provide commented, minimal, self-contained, reproducible code.
>


-- 
Henrique Dallazuanna
Curitiba-Paran?-Brasil
25? 25' 40" S 49? 16' 22" O