[R] Help wit matrices

John Kane jrkrideau at yahoo.ca
Fri Aug 10 20:26:57 CEST 2007


Will something like this help?

mm <- matrix(rnorm(100),nrow=10)
mm
nn  <-  mm  >.5
nn

--- Lanre Okusanya <lanre.okusanya at gmail.com> wrote:

> Hello all,
> 
> I am working with a 1000x1000 matrix, and I would
> like to return a
> 1000x1000 matrix that tells me which value in the
> matrix is greater
> than a theshold value (1 or 0 indicator).
> i have tried
>   mat2<-as.matrix(as.numeric(mat1>0.25))
> but that returns a 1:100000 matrix.
> I have also tried for loops, but they are grossly
> inefficient.
> 
> THanks for all your help in advance.
> 
> Lanre
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



More information about the R-help mailing list