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 pro

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

Re: [R] TRUE/FALSE as numeric values

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

Re: [R] TRUE/FALSE as numeric values

2007-02-23 Thread Chuck Cleland
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

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 FAL

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 FAL

[R] TRUE/FALSE as numeric values

2007-02-23 Thread Thomas Preuth
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