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 FALSE TRUE
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 FALSE TRUE TRUE
RSF_EU$AREA[RSF_EU$AREA=x]
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and
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
FALSE
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