Hi R People: I'm teaching a statistical computing class using R starting next week (yay!) and I have an opinion type question, please. I'm old school and use "<-" in an assignment. However, I'm starting to see the "=" in the literature. Which should I use or does it matter, please? Thanks for your input! Sincerely, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodgess at gmail.com
On 15/01/2010, at 4:45 PM, Erin Hodgess wrote:> Hi R People: > > I'm teaching a statistical computing class using R starting next week > (yay!) and I have an opinion type question, please. > > I'm old school and use "<-" in an assignment. > > However, I'm starting to see the "=" in the literature. > > Which should I use or does it matter, please?It's basically a matter of taste. But people with ***good*** taste use "<-". :-) Constructions such as "a = a+3" are toadally illogical whereas "a <- a +3" makes perfect sense. However I'm sore afraid that as is always the case, good taste fails and bad taste prevails. I.e. "=" for assignment will take over. Personally I shall resist as long as possible, i.e. until "<-" is removed from the syntax structure by R Core. cheers, Rolf ###################################################################### Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
On Fri, Jan 15, 2010 at 3:45 AM, Erin Hodgess <erinm.hodgess@gmail.com>wrote:> Hi R People: > > I'm teaching a statistical computing class using R starting next week > (yay!) and I have an opinion type question, please. > > I'm old school and use "<-" in an assignment. > >You call that 'old school'?? I still use ' x_1'! Of course ESS turns the underscore into '<-' magically. Perhaps these guys should redo their tests with slightly different syntax: http://www.cs.mdx.ac.uk/research/PhDArea/saeed/paper1.pdf Barry -- blog: http://geospaced.blogspot.com/ web: http://www.maths.lancs.ac.uk/~rowlings web: http://www.rowlingson.com/ twitter: http://twitter.com/geospacedman pics: http://www.flickr.com/photos/spacedman [[alternative HTML version deleted]]
I've only been using R for about 2.5 years but and I'm not all that good but I vote for <- . I think the deciding factor is in RSiteSearch() and the various manuals. Almost everything I see uses <- . Why introduce = when it is not used normally? It will just confuse the students who are trying to use any of the documentation. Not to mention they might slammed for bad syntax on the R-help mailing list. :) --- On Thu, 1/14/10, Erin Hodgess <erinm.hodgess at gmail.com> wrote:> From: Erin Hodgess <erinm.hodgess at gmail.com> > Subject: [R] advice/opinion on "<-" vs "=" in teaching R > To: "R help" <r-help at stat.math.ethz.ch> > Received: Thursday, January 14, 2010, 10:45 PM > Hi R People: > > I'm teaching a statistical computing class using R starting > next week > (yay!) and I have an opinion type question, please. > > I'm old school and use "<-" in an assignment. > > However, I'm starting to see the "=" in the literature. > > Which should I use or does it matter, please? > > Thanks for your input! > Sincerely, > Erin > > > -- > Erin Hodgess > Associate Professor > Department of Computer and Mathematical Sciences > University of Houston - Downtown > mailto: erinm.hodgess at gmail.com > > ______________________________________________ > R-help at 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. >__________________________________________________________________ The new Internet Explorer? 8 - Faster, safer, easier. Optimized for Yahoo! Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/
On Thu, 14 Jan 2010, Erin Hodgess wrote:> Hi R People: > > I'm teaching a statistical computing class using R starting next week > (yay!) and I have an opinion type question, please. > > I'm old school and use "<-" in an assignment. > > However, I'm starting to see the "=" in the literature. > > Which should I use or does it matter, please?I would say to use = if you are teaching people familiar with C or Java, and to use <- otherwise. -thomas Thomas Lumley Assoc. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle
>>> Thomas Lumley <tlumley at u.washington.edu> 15/01/2010 16:07 >>> >> Which should I use or does it matter, please? > >I would say to use = if you are teaching people familiar with C orJava, and to use <- otherwise. Nothing like an option to induce polarisation! '=' is used in at least two contexts in R, one of which does not imply formal assignment. '<-' (and the left-to-right version '->') only mean formal assignment. It is nearly always better in teaching programming languages to teach the unambiguous/'always safe' form first or only. Anyone who learns multiple languages should be able to cope with such a small change in operator, and the rather important difference between assignment, name/value pairing and logical equals that R makes explicit is actually a useful indicator that they are genuinely different things. Steve Ellison ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}}