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-boun...@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@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.

______________________________________________
R-help@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.

Reply via email to