Skip to content
Back to formatted view

Raw Message

Message-ID: <OF7F2C3AEC.74E69FBF-ONC12577F3.00332929-C12577F3.0033C8B4@precheza.cz>
Date: 2010-12-08T09:24:58Z
From: PIKAL Petr
Subject: Odp: how to find smallest non-negative and biggest non-positive number in a matrix column ?
In-Reply-To: <1291798375636-3077870.post@n4.nabble.com>

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 guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.