[R] trheshold matrix

Uwe Ligges ligges at statistik.tu-dortmund.de
Fri Jun 3 14:47:56 CEST 2011



On 03.06.2011 10:09, Alaios wrote:
> Dear all I want to put zeros and ones in matrix I have if the values are over a threshold
>
> For that I use:
>
> origBoolmap<- (origmap>thresh )


origBoolmap <- as.numeric(origmap>thresh )

should do it without need for any other code.

Uwe Ligges





> origBoolmap[thresh<  origmap]<- 1
> origBoolmap[thresh>= origmap]<- 0
>
> Could you please tell me if the first line out of the three is useless? I have checked and seems taht I take the same results.
>
> Best Regards
> Alex
>
> ______________________________________________
> 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.



More information about the R-help mailing list