Re: [R] argh .. if/else .. why?

2010-02-16 Thread Peter Dalgaard
Gabor Grothendieck wrote: On Mon, Feb 15, 2010 at 11:24 AM, David Winsemius dwinsem...@comcast.net wrote: On Feb 15, 2010, at 11:01 AM, hadley wickham wrote: I, personally, utilize the ifelse(test,statement,statement) function when possible over the methodology outlined. if + else and

Re: [R] argh .. if/else .. why?

2010-02-16 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Peter Dalgaard Sent: Tuesday, February 16, 2010 1:33 AM To: Gabor Grothendieck Cc: r-help@r-project.org Subject: Re: [R] argh .. if/else .. why? Gabor Grothendieck wrote

Re: [R] argh .. if/else .. why?

2010-02-16 Thread David Winsemius
On Feb 16, 2010, at 12:15 PM, William Dunlap wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Peter Dalgaard Sent: Tuesday, February 16, 2010 1:33 AM To: Gabor Grothendieck Cc: r-help@r-project.org Subject: Re: [R] argh

[R] argh .. if/else .. why?

2010-02-15 Thread Esmail
Hello, would someone please help explain the following inconsistency in the if/else statement to me? The format of the if/else #3 below is ok, but if/else #1 is not? (I get an unexpected else type error.) In order for it to work I have to use if/else #2 Thanks .. maybe there is some reason for

Re: [R] argh .. if/else .. why?

2010-02-15 Thread jim holtman
Check back in the archieves. This is a common question. The problem is basically when input commands at the command line, when you hit the carriage return it is assuming there is a complete command. 'if' not followed by an 'else' is assumed to be complete and when you type the 'else' by itself

Re: [R] argh .. if/else .. why?

2010-02-15 Thread Lee.Adams
[mailto:r-help-boun...@r-project.org] On Behalf Of jim holtman Sent: Monday, February 15, 2010 8:13 AM To: Esmail Cc: r-help@r-project.org Subject: Re: [R] argh .. if/else .. why? Check back in the archieves. This is a common question. The problem is basically when input commands at the command

Re: [R] argh .. if/else .. why?

2010-02-15 Thread Esmail
On 15-Feb-10 09:13, jim holtman wrote: This is a common question. The problem is basically when input commands at the command line, when you hit the carriage return it is assuming there is a complete command. Within a function, or a block like the 'for' loop, the statement is not complete

Re: [R] argh .. if/else .. why?

2010-02-15 Thread Esmail
On 15-Feb-10 09:27, lee.ad...@luminant.com wrote: I, personally, utilize the ifelse(test,statement,statement) function when possible over the methodology outlined. Haven't used that construct before, I'll check it out. Thanks. And mystery solved. Esmail

Re: [R] argh .. if/else .. why?

2010-02-15 Thread Peter Dalgaard
Esmail wrote: Ah .. so the fact that this is inside a block (in this case a function) makes a difference .. I see .. well this is certainly different from other languages I have worked with, but the explanation is clear. Yes. I think most people involved have realized that it was a design

Re: [R] argh .. if/else .. why?

2010-02-15 Thread hadley wickham
I, personally, utilize the ifelse(test,statement,statement) function when possible over the methodology outlined. if + else and ifelse perform quite different tasks, and in general can not (and should not) be exchanged. In particular, note that for ifelse, the class attribute of the result is

Re: [R] argh .. if/else .. why?

2010-02-15 Thread David Winsemius
On Feb 15, 2010, at 11:01 AM, hadley wickham wrote: I, personally, utilize the ifelse(test,statement,statement) function when possible over the methodology outlined. if + else and ifelse perform quite different tasks, and in general can not (and should not) be exchanged. In particular,

Re: [R] argh .. if/else .. why?

2010-02-15 Thread Gabor Grothendieck
On Mon, Feb 15, 2010 at 11:24 AM, David Winsemius dwinsem...@comcast.net wrote: On Feb 15, 2010, at 11:01 AM, hadley wickham wrote: I, personally, utilize the ifelse(test,statement,statement) function when possible over the methodology outlined. if + else and ifelse perform quite different