It is inefficient to use which() rather than a logical index, since you
allocate two numeric index vectors (one the length of the original
vector) and use an interpreted function rather than optimized C code.
Also, in this usage which() handles NAs incorrectly.
I think the clearest answer is pro
On Fri, 2007-02-23 at 14:38 +0100, Thomas Preuth wrote:
> Hello,
>
> I want to select in a column of a dataframe all numbers smaller than a
> value x
> but when I type in test<-(RSF_EU$AREA<=x) I receiv as answer:
> > test
> [1] TRUE FALSE FALSE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE
ate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney
> -Oorspronkelijk bericht-
> Van: [EMAIL PROTECTED] [mailto:r-help-
> [EMAIL PROTECTED] Namens Thomas Preuth
> Verzonden: vrijdag 23 februari 2007 14:39
> Aan: r-help@stat.math.ethz.ch
> Onderwe
Thomas Preuth wrote:
> Hello,
>
> I want to select in a column of a dataframe all numbers smaller than a
> value x
> but when I type in test<-(RSF_EU$AREA<=x) I receiv as answer:
> > test
> [1] TRUE FALSE FALSE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE
> FALSE TRUE TRUE TRUE TRUE T
You can also:
test <- RSF_EU[which(RSF_EU$AREA<=x),]
On 23/02/07, Thomas Preuth <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I want to select in a column of a dataframe all numbers smaller than a
> value x
> but when I type in test<-(RSF_EU$AREA<=x) I receiv as answer:
> > test
> [1] TRUE FALSE FAL
On Fri, 23 Feb 2007 14:38:56 +0100 Thomas Preuth <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I want to select in a column of a dataframe all numbers smaller than a
> value x
> but when I type in test<-(RSF_EU$AREA<=x) I receiv as answer:
> > test
> [1] TRUE FALSE FALSE TRUE TRUE TRUE FALSE FAL
Hello,
I want to select in a column of a dataframe all numbers smaller than a
value x
but when I type in test<-(RSF_EU$AREA<=x) I receiv as answer:
> test
[1] TRUE FALSE FALSE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE
FALSE TRUE TRUE TRUE TRUE TRUE
[18] TRUE TRUE TRUE TRUE FALS