P.Dalgaard wrote:
IF TYPE='TRUCK' and count=12 THEN VEHICLES=TRUCK+((CAR+BIKE)/2.2);
vehicles - ifelse(TYPE=='TRUCK' count=12, TRUCK+((CAR+BIKE)/2.2), NA)
Read both versions to an audience, and you will have to admit that this is
one of the cases where SAS is superior.
Dieter
Dieter Menne wrote:
P.Dalgaard wrote:
IF TYPE='TRUCK' and count=12 THEN VEHICLES=TRUCK+((CAR+BIKE)/2.2);
vehicles - ifelse(TYPE=='TRUCK' count=12, TRUCK+((CAR+BIKE)/2.2), NA)
Read both versions to an audience, and you will have to admit that this is
one of the cases where SAS is
that a reasonable answer can
be extracted from a given body of data. - John Tukey.
-Original Message-
From: r-help-boun...@r-project.org on behalf of Dieter Menne
Sent: Tue 23/06/2009 4:43 PM
To: r-help@r-project.org
Subject: Re: [R] SAS-like method of recoding variables?
P.Dalgaard wrote
Simon Blomberg-4 wrote:
I'm not sure we should measure superiority by how well a statement parses
into English. If this were true, we would all be programming in COBOL.
P.Dalgaard wrote:
IF TYPE='TRUCK' and count=12 THEN VEHICLES=TRUCK+((CAR+BIKE)/2.2);
vehicles -
Dieter Menne wrote:
IF TYPE='TRUCK' and count=12 THEN VEHICLES=TRUCK+((CAR+BIKE)/2.2);
vehicles - ifelse(TYPE=='TRUCK' count=12, TRUCK+((CAR+BIKE)/2.2), NA)
Read both versions to an audience, and you will have to admit that this is
one of the cases where SAS is superior.
And Peter
You can also use if (cond) then {something} if you don't like ifelse()
function. See ?Control.
David
2009/6/23 Peter Flom peterflomconsult...@mindspring.com
Dieter Menne wrote:
IF TYPE='TRUCK' and count=12 THEN VEHICLES=TRUCK+((CAR+BIKE)/2.2);
vehicles - ifelse(TYPE=='TRUCK' count=12,
David Hajage-2 wrote:
You can also use if (cond) then {something} if you don't like ifelse()
function. See ?Control.
The minor difference that if() is not vectorized is a source of FAQs.
Dieter
--
View this message in context:
On Jun 23, 2009, at 7:40 AM, David Hajage wrote:
You can also use if (cond) then {something} if you don't like ifelse()
function. See ?Control.
Had you followed you own advice, you should have seen why this is
completely misleading in the curret context.
cond
A length-one logical vector
Dieter Menne wrote:
P.Dalgaard wrote:
IF TYPE='TRUCK' and count=12 THEN VEHICLES=TRUCK+((CAR+BIKE)/2.2);
vehicles - ifelse(TYPE=='TRUCK' count=12, TRUCK+((CAR+BIKE)/2.2), NA)
Read both versions to an audience, and you will have to admit that this is
one of the cases where SAS is
Frank E Harrell Jr wrote:
Here's a case where SAS is clearly not superior:
IF type='TRUCK' AND count12 THEN vehicles=truck+(car+bike)/2.2;
If count is missing, the statement is considered TRUE and the THEN is
executed. This is because SAS considers a missing as less than any
Frank, would you feel comfortable giving us the reference to the NEJM article
with the 'missing vs ' error ? I'm sure that things like this happen
fairly often, and I'd like to use this example in teaching
thanks, david freedman
Frank E Harrell Jr wrote:
Dieter Menne wrote:
P.Dalgaard
David Freedman wrote:
Frank, would you feel comfortable giving us the reference to the NEJM article
with the 'missing vs ' error ? I'm sure that things like this happen
fairly often, and I'd like to use this example in teaching
thanks, david freedman
@ARTICLE{gus93int,
author = {{The GUSTO
Dear R-helpers,
I am helping a SAS user run some analyses in R that she cannot do in
SAS and she is complaining about R's peculiar (to her!) way of
recoding variables. In particular, she is wondering if there is an R
package that allows this kind of SAS recoding:
IF TYPE='TRUCK' and count=12
On Jun 22, 2009, at 2:27 PM, Mark Na wrote:
Dear R-helpers,
I am helping a SAS user run some analyses in R that she cannot do in
SAS and she is complaining about R's peculiar (to her!) way of
recoding variables. In particular, she is wondering if there is an R
package that allows this kind of
On 6/22/2009 2:27 PM, Mark Na wrote:
Dear R-helpers,
I am helping a SAS user run some analyses in R that she cannot do in
SAS and she is complaining about R's peculiar (to her!) way of
recoding variables. In particular, she is wondering if there is an R
package that allows this kind of SAS
Mark Na wrote:
Dear R-helpers,
I am helping a SAS user run some analyses in R that she cannot do in
SAS and she is complaining about R's peculiar (to her!) way of
recoding variables. In particular, she is wondering if there is an R
package that allows this kind of SAS recoding:
IF TYPE='TRUCK'
16 matches
Mail list logo