Re: [R] Is there any difference between - and =

2009-03-13 Thread Wacek Kusnierczyk
Sean Zhang wrote: Dear Jens and Wacek: I appreciate your answers very much. I came up an example based on your comments. I feel the example helped me to understand...(I could be missing your points though :( ) If so, please let me know. Simon pointed out the following link:

Re: [R] Is there any difference between - and =

2009-03-13 Thread Alan Zaslavsky
I would argue that this is a matter of preference and the arguments on principle for one side or another are not particularly compelling. When the = was introduced for assignment, an argument was made that name=value function arguments are also implicitly a kind of assignment. While Duncan has

Re: [R] Is there any difference between - and =

2009-03-13 Thread Wacek Kusnierczyk
Alan Zaslavsky wrote: I would argue that this is a matter of preference and the arguments on principle for one side or another are not particularly compelling. indeed; i have argued (i think...) for treating them as equals, the vhoice being a matter of taste. When the = was introduced for

Re: [R] Is there any difference between - and =

2009-03-13 Thread Alan Zaslavsky
thanks for your supportive comments! by that time r programs will be scanned directly from your head, i suppose, and the intelligent scanner will as gladly take - as it will =, so the problem will rather vanish. Yes, and maybe the scanner will be more intelligent than the programmer so when

Re: [R] Is there any difference between - and =

2009-03-12 Thread Jens Oehlschlägel
Sean, would like to receive expert opinion to avoid potential trouble [..] i think the following is the most secure way if one really really has to do assignment in a function call f({a=3}) and if one keeps this convention, - can be dropped altogether. secure is relative, since due to

Re: [R] Is there any difference between - and =

2009-03-12 Thread Wacek Kusnierczyk
Jens Oehlschlägel wrote: Sean, would like to receive expert opinion to avoid potential trouble [..] i think the following is the most secure way if one really really has to do assignment in a function call f({a=3}) and if one keeps this convention, - can be dropped

Re: [R] Is there any difference between - and =

2009-03-12 Thread David M Smith
On Thu, Mar 12, 2009 at 8:29 AM, Jens Oehlschlägel oehl_l...@gmx.de wrote: Thus there is dangerous advice in the referenced blog which reads: f(x - 3) which means assign 3 to x, and call f with the first argument set to the value 3 The thrust of the blog post was the stylistic question

Re: [R] Is there any difference between - and =

2009-03-12 Thread Simon Blomberg
I think Venables' and Ripley's convention makes good sense: http://www.stat.auckland.ac.nz/mail/archive/r-downunder/2008-October/000300.html So we not only are explicit about what we are assigning, but where we are assigning it. Cheers, Simon. On Thu, 2009-03-12 at 17:10 -0700, David M Smith

Re: [R] Is there any difference between - and =

2009-03-12 Thread Sean Zhang
Dear Jens and Wacek: I appreciate your answers very much. I came up an example based on your comments. I feel the example helped me to understand...(I could be missing your points though :( ) If so, please let me know. Simon pointed out the following link:

Re: [R] Is there any difference between - and =

2009-03-12 Thread HBaize
I think most people find it odd at first if they have always used = but quickly you get use to it and nothing could be more clear. It is explicit. It is active and provides a direction, a value goes into an object. The equal sign for assignment is ambiguous. As an example x = 3 we only

[R] Is there any difference between - and =

2009-03-11 Thread Sean Zhang
Dear R-helpers: I have a question related to - and =. I saw very experienced R programmers use = rather than - quite consistently. However, I heard from others that do not use = but always stick to - when assigning valuese. I personally like = because I was using Matabl, But, would like to

Re: [R] Is there any difference between - and =

2009-03-11 Thread Duncan Murdoch
On 3/11/2009 10:18 AM, Sean Zhang wrote: Dear R-helpers: I have a question related to - and =. I saw very experienced R programmers use = rather than - quite consistently. However, I heard from others that do not use = but always stick to - when assigning valuese. I personally like = because

Re: [R] Is there any difference between - and =

2009-03-11 Thread David M Smith
On Wed, Mar 11, 2009 at 7:18 AM, Sean Zhang seane...@gmail.com wrote: Dear R-helpers: I have a question related to - and =. I saw very experienced R programmers use = rather than - quite consistently. However, I heard from others that do not use = but always stick to - when assigning

Re: [R] Is there any difference between - and =

2009-03-11 Thread Wacek Kusnierczyk
Duncan Murdoch wrote: Use - for assignment, and = for function arguments. Then the difference between f( a = 3 ) f( a - 3 ) is clear, and you won't be surprised that a gets changed in the second case. If you use = for assignment, the two lines above will be written as f( a = 3 )