Re: [R] TRUE/FALSE as numeric values

2007-02-23 Thread Ranjan Maitra
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

Re: [R] TRUE/FALSE as numeric values

2007-02-23 Thread Henrique Dallazuanna
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

Re: [R] TRUE/FALSE as numeric values

2007-02-23 Thread ONKELINX, Thierry
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

Re: [R] TRUE/FALSE as numeric values

2007-02-23 Thread Gavin Simpson
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

Re: [R] TRUE/FALSE as numeric values

2007-02-23 Thread Prof Brian Ripley
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