madr
2010-Dec-08 08:52 UTC
[R] how to find smallest non-negative and biggest non-positive number in a matrix column ?
so it could be zero in both cases when given column has 0 set in it -- View this message in context: http://r.789695.n4.nabble.com/how-to-find-smallest-non-negative-and-biggest-non-positive-number-in-a-matrix-column-tp3077870p3077870.html Sent from the R help mailing list archive at Nabble.com.
Petr PIKAL
2010-Dec-08 09:24 UTC
[R] Odp: how to find smallest non-negative and biggest non-positive number in a matrix column ?
Hi x<-rnorm(20) max(x[x<=0]) [1] -0.1028260 x<-c(x,0) max(x[x<=0]) min(x[x>=0]) AFAIK there is no other number fulfilling both criteria other than zero. So if you want both criteria to be true (as your "and" suggests), just check if there is zero. Regards Petr r-help-bounces at r-project.org napsal dne 08.12.2010 09:52:55:> > so it could be zero in both cases when given column has 0 set in it > -- > View this message in context: http://r.789695.n4.nabble.com/how-to-find- >smallest-non-negative-and-biggest-non-positive-number-in-a-matrix-column-> tp3077870p3077870.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
Maybe Matching Threads
- replace negative numbers by smallest positive value in matrix
- find the index of the smallest or biggest number in a vetor or data.frame
- smallest/biggest number
- "negative alpha" or custom gradient colors of data dots in scatterplot ?
- increase or decrease variable by 1