Re: [R] difference between assignment syntax - vs =
Hi, thanks for the link. In the bottom part of the relevant section, you say: Standard advice is to avoid using '=' when you mean '-' Is this a formal, generally accepted (R community) advice, or does it reflect you personal opinion? Note I am not asking this question as to criticize by any means, but instead I just want to know for my own work (which will be partially released to others) if the '-' - style is the preferred one (Personally, with a strong background from other programming languages, I have always used '=' so far). thanks, Thomas Patrick Burns wrote: 'The R Inferno' page 78 is one source you can look at. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) Thomas Mang wrote: Hi, Both operators - and = can be used to make an assignment. My question is: Is there a semantic difference between these two? Some time ago, I remember I have read that because of some reason, one should be given preference over the other - but I cannot remember the source, nor the argument, nor which operator the preferred was. What is the present state ? Is still one version better than the other, or is it only a matter of taste what to use ? thanks Thomas __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] difference between assignment syntax - vs =
Since this topic came up, I've been thinking that that sentence needs more work. The standard is not from me -- I'm a bit more agnostic than the statement although I personally always use '-'. I'm thinking a revised version might be something along the lines of: Standard advice from most long-time R users is to avoid using '=' when you mean '-'. However, as long as you avoid the traps, it is really a matter of taste. Rejoinders, etc. will be considered for whenever a revised Inferno appears. Pat Thomas Mang wrote: Hi, thanks for the link. In the bottom part of the relevant section, you say: Standard advice is to avoid using '=' when you mean '-' Is this a formal, generally accepted (R community) advice, or does it reflect you personal opinion? Note I am not asking this question as to criticize by any means, but instead I just want to know for my own work (which will be partially released to others) if the '-' - style is the preferred one (Personally, with a strong background from other programming languages, I have always used '=' so far). thanks, Thomas Patrick Burns wrote: 'The R Inferno' page 78 is one source you can look at. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) Thomas Mang wrote: Hi, Both operators - and = can be used to make an assignment. My question is: Is there a semantic difference between these two? Some time ago, I remember I have read that because of some reason, one should be given preference over the other - but I cannot remember the source, nor the argument, nor which operator the preferred was. What is the present state ? Is still one version better than the other, or is it only a matter of taste what to use ? thanks Thomas __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] difference between assignment syntax - vs =
On Mon, 23 Feb 2009, Patrick Burns wrote: Since this topic came up, I've been thinking that that sentence needs more work. The standard is not from me -- I'm a bit more agnostic than the statement although I personally always use '-'. I'm thinking a revised version might be something along the lines of: Standard advice from most long-time R users is to avoid using '=' when you mean '-'. However, as long as you avoid the traps, it is really a matter of taste. Although it's probably true that most long-time R users use -, this is at least in part because a long-time R user would initially have had to use -, since = wasn't available in the distant past. I would say that it's entirely a matter of taste -- the things that otherwise could have been traps are mostly syntax errors. The only proviso is that if you post code using = it is (even more) important to leave spaces around the = than it would be for -. -thomas Rejoinders, etc. will be considered for whenever a revised Inferno appears. Pat Thomas Mang wrote: Hi, thanks for the link. In the bottom part of the relevant section, you say: Standard advice is to avoid using '=' when you mean '-' Is this a formal, generally accepted (R community) advice, or does it reflect you personal opinion? Note I am not asking this question as to criticize by any means, but instead I just want to know for my own work (which will be partially released to others) if the '-' - style is the preferred one (Personally, with a strong background from other programming languages, I have always used '=' so far). thanks, Thomas Patrick Burns wrote: 'The R Inferno' page 78 is one source you can look at. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) Thomas Mang wrote: Hi, Both operators - and = can be used to make an assignment. My question is: Is there a semantic difference between these two? Some time ago, I remember I have read that because of some reason, one should be given preference over the other - but I cannot remember the source, nor the argument, nor which operator the preferred was. What is the present state ? Is still one version better than the other, or is it only a matter of taste what to use ? thanks Thomas __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Thomas Lumley Assoc. Professor, Biostatistics tlum...@u.washington.eduUniversity of Washington, Seattle __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] difference between assignment syntax - vs =
Thomas Lumley wrote: Although it's probably true that most long-time R users use -, this is at least in part because a long-time R user would initially have had to use -, since = wasn't available in the distant past. I would say that it's entirely a matter of taste -- the things that otherwise could have been traps are mostly syntax errors. The only proviso is that if you post code using = it is (even more) important to leave spaces around the = than it would be for -. the reason being ...? vQ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] difference between assignment syntax - vs =
Wacek Kusnierczyk Waclaw.Marcin.Kusnierczyk at idi.ntnu.no writes: Thomas Lumley wrote: Although it's probably true that most long-time R users use -, this is at least in part because a long-time R user would initially have had to use -, since = wasn't available in the distant past. I would say that it's entirely a matter of taste -- the things that otherwise could have been traps are mostly syntax errors. The only proviso is that if you post code using = it is (even more) important to leave spaces around the = than it would be for -. the reason being ...? vQ ergonomy! -- Ken Knoblauch Inserm U846 Stem-cell and Brain Research Institute Department of Integrative Neurosciences 18 avenue du Doyen Lépine 69500 Bron France tel: +33 (0)4 72 91 34 77 fax: +33 (0)4 72 91 34 61 portable: +33 (0)6 84 10 64 10 http://www.sbri.fr/members/kenneth-knoblauch.html __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] difference between assignment syntax - vs =
Ken Knoblauch wrote: Wacek Kusnierczyk Waclaw.Marcin.Kusnierczyk at idi.ntnu.no writes: Thomas Lumley wrote: Although it's probably true that most long-time R users use -, this is at least in part because a long-time R user would initially have had to use -, since = wasn't available in the distant past. I would say that it's entirely a matter of taste -- the things that otherwise could have been traps are mostly syntax errors. The only proviso is that if you post code using = it is (even more) important to leave spaces around the = than it would be for -. the reason being ...? vQ ergonomy! ergonomy? vQ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] difference between assignment syntax - vs =
It's easier to read. Better machine-human interaction. ergonomic: (esp. of workplace design) intended to provide optimum comfort and to avoid stress or injury. Quoting Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no: Ken Knoblauch wrote: Wacek Kusnierczyk Waclaw.Marcin.Kusnierczyk at idi.ntnu.no writes: Thomas Lumley wrote: Although it's probably true that most long-time R users use -, this is at least in part because a long-time R user would initially have had to use -, since = wasn't available in the distant past. I would say that it's entirely a matter of taste -- the things that otherwise could have been traps are mostly syntax errors. The only proviso is that if you post code using = it is (even more) important to leave spaces around the = than it would be for -. the reason being ...? vQ ergonomy! ergonomy? vQ -- Ken Knoblauch Inserm U846 Stem-cell and Brain Research Institute Department of Integrative Neurosciences 18 avenue du Doyen Lépine 69500 Bron France tel: +33 (0)4 72 91 34 77 fax: +33 (0)4 72 91 34 61 portable: +33 (0)6 84 10 64 10 http://www.sbri.fr/members/kenneth-knoblauch.html __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] difference between assignment syntax - vs =
Hi, Both operators - and = can be used to make an assignment. My question is: Is there a semantic difference between these two? Some time ago, I remember I have read that because of some reason, one should be given preference over the other - but I cannot remember the source, nor the argument, nor which operator the preferred was. What is the present state ? Is still one version better than the other, or is it only a matter of taste what to use ? thanks Thomas __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] difference between assignment syntax - vs =
Patrick Burns wrote: 'The R Inferno' page 78 is one source you can look at. Patrick Burns wow .. nice! .. thanks for posting this reference. Esmail __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.