Hi,
sorry, but it shouldn't be "different". The result should be the same but I was
looking if there is a method I can use...
# having a function defined like baptiste proposed:
isIn <-
function (interval, x)
{
(x > min(interval)) & (x < max(interval))
}
#----------------------
a <- rnorm(100)
# it's simply more human readable if I can write
which( isIn( c(-0.5, 0.5), a) )
# instead of
which( a > -0.5 & a < 0.5 )
Thanks to baptiste! So there is no method available doing this and I have to
define this by myself. That's all I wanted to know :-)
Antje
markle...@verizon.net schrieb:
hi: could you explain EXACTLY what you want to do with the dataframe
because it shouldn't be that different ?
On Tue, Dec 16, 2008 at 5:09 AM, Antje wrote:
Hi all,
I'd like to know, if I can solve this with a shorter command:
a <- rnorm(100)
which(a > -0.5 & a < 0.5)
# would give me all indices of numbers greater than -0.5 and smaller
than +0.5
I have something similar with a dataframe and it produces sometimes
quite long commands...
I'd like to have something like:
which(within.interval(a, -0.5, 0.5))
Is there anything I could use for this purpose?
Antje
______________________________________________
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.