Re: [R] creating a matrix subset based on a threshold cutoff

From: <rich_at_thevillas.eclipse.co.uk>
Date: Tue, 04 Mar 2008 13:19:31 +0000

   that's great, thanks
   On Tue Mar 4 12:29 , "Henrique Dallazuanna" sent:    

     I think that this shoul works:
     do.call(rbind, apply(as.table(x), 1, function(.x).x[any(.x < cutoff)]))
     Change as.table(x) by your table
     On 04/03/2008, rich @ thevillas. eclipse. co. uk
     <[1]rich_at_thevillas.eclipse.co.uk> wrote:

>
>
>
>
> sorry, it would probably better be described as a table
>
> thanks
>
>
>
>
>
> On Tue Mar 4 11:28 , "Henrique Dallazuanna" sent:
>
>
> 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, [2]rich_at_thevillas.eclipse.co.uk
> <[3]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
> > ______________________________________________
> > [4]R-help_at_r-project.org mailing list
> > [5]https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> [6]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
>
>
>
>
-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O

References

  1. javascript:top.opencompose('rich_at_thevillas.eclipse.co.uk','','','')
  2. javascript:top.opencompose('rich_at_thevillas.eclipse.co.uk','','','')
  3. javascript:top.opencompose('rich_at_thevillas.eclipse.co.uk','','','')
  4. javascript:top.opencompose('R-help_at_r-project.org','','','')
  5. file://localhost/tmp/parse.pl?redirect=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help
  6. file://localhost/tmp/parse.pl?redirect=http%3A%2F%2Fwww.R-project.org%2Fposting-guide.html
    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.
Received on Tue 04 Mar 2008 - 13:28:15 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 04 Mar 2008 - 13:30:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive