Skip to content

how to find smallest non-negative and biggest non-positive number in a matrix column ?

2 messages · madr, PIKAL Petr

#
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:
smallest-non-negative-and-biggest-non-positive-number-in-a-matrix-column-
http://www.R-project.org/posting-guide.html