peter dalgaard wrote:
> O2 < 2d < O3 had been even stranger, no?
Don't give those dudes in Cupertino any more bright ideas, okay?
Jim
On Wed, Nov 18, 2015 at 12:11 PM, peter dalgaard wrote:
>
> > On 18 Nov 2015, at 01:59 , Jeff Newmiller
> wrote:
> >
> > Are you sure that wasn't oh-3 rather
> On 18 Nov 2015, at 01:59 , Jeff Newmiller wrote:
>
> Are you sure that wasn't oh-3 rather than 03?
Sure I'm sure. I even cut+pasted the filenames from the offending dir... It's
all just Apple trying to be helpful (and failing, again).
O2 < 2d < O3 had been even stranger, no?
-p
>
Are you sure that wasn't oh-3 rather than 03?
---
Jeff NewmillerThe . . Go Live...
DCN:Basics: ##.#. ##.#. Live Go...
Live: OO#..
ogy
> Texas A&M University
> College Station, TX 77840-4352
>
>
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of peter dalgaard
> Sent: Tuesday, November 17, 2015 3:57 PM
> To: Bert Gunter
> Cc: r-help
> Subject:
ay, November 17, 2015 3:57 PM
To: Bert Gunter
Cc: r-help
Subject: Re: [R] Strange result when subsetting a data frame based on a
character variable
> On 17 Nov 2015, at 20:37 , Bert Gunter wrote:
>
>> 2 == "2"
> [1] TRUE
>
> ?"==" says:
>
> "If t
> On 17 Nov 2015, at 20:37 , Bert Gunter wrote:
>
>> 2 == "2"
> [1] TRUE
>
> ?"==" says:
>
> "If the two arguments are atomic vectors of different types, one is
> coerced to the type of the other, the (decreasing) order of precedence
> being character, complex, numeric, integer, logical and r
Dear Duncan,
I'd rather convert the numeric to character. E.g. with sprintf() or
format() in case it is a numeric vector.
subset(Data, group == "10")
subset(Data, group == sprintf("%.f", 10))
sprintf("%.f", 10) # "10"
It requires the user to think about the format, which can red
On 17/11/2015 2:25 PM, Duncan Murdoch wrote:
On 17/11/2015 2:14 PM, Karl Schilling wrote:
> Dear all,
>
> I have one observation that I do not quite understand. Maybe someone
> can clarify this issue for me.
>
> I have a data frame which I want to subset based on a grouping variable,
> say "group
> 2 == "2"
[1] TRUE
?"==" says:
"If the two arguments are atomic vectors of different types, one is
coerced to the type of the other, the (decreasing) order of precedence
being character, complex, numeric, integer, logical and raw."
> as.character(9)
[1] "9"
> as.character(10)
[1] "
Dear Karl,
Since you compare a character with a numeric, R converts the numeric
silently. And then you're into trouble.
as.character(9) # "9"
as.character(10) # "1e+5"
Bottom line, use the same type on both sides of the binary operator.
Best regards,
ir. Thierry Onkelinx
Instituut
On 17/11/2015 2:14 PM, Karl Schilling wrote:
Dear all,
I have one observation that I do not quite understand. Maybe someone
can clarify this issue for me.
I have a data frame which I want to subset based on a grouping variable,
say "group". Actually, "group" is a numeric value, but it is saved
R silently converts the integer to a character for comparison in the subset
operation. But if we explicitly do the conversion we see that it does not work
with the default R settings.
> as.character(10)
[1] "1e+05"
> as.character(9)
[1] "9"
--
W. Michael Conklin
EVP Marketing & Da
12 matches
Mail list logo