Try this:
min(diff(sort(x))[diff(sort(x))0])
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O
On 10/09/2007, dxc13 [EMAIL PROTECTED] wrote:
useRs,
I am looking to find the minimum positive value of some data I have.
Currently, I am able to find the minimum of
On Mon, 2007-09-10 at 11:20 -0700, dxc13 wrote:
useRs,
I am looking to find the minimum positive value of some data I have.
Currently, I am able to find the minimum of data after I apply some other
functions to it:
x
[1] 1 0 1 2 3 3 4 5 5 5 6 7 8 8 9 9 10 10
Here are some solutions each of which
1. has only one line,
2. x only occurs once so you can just plug in a complex expression
3. no temporary variables are left
min(sapply(x, function(z) if (z 0) z else Inf))
(function(z) min(ifelse(z 0, z, Inf))) (x)
with(list(z = x), min(z[z 0]))
local({
Either
min(diff(sort(x))[diff(sort(x))0])
or
min(diff(sort(unique(x
--- dxc13 [EMAIL PROTECTED] wrote:
useRs,
I am looking to find the minimum positive value of
some data I have.
Currently, I am able to find the minimum of data
after I apply some other
functions to it:
x