[R] advice/opinion on " < -" vs " =" in teaching R
Douglas Bates
bates at stat.wisc.edu
Fri Jan 15 21:41:37 CET 2010
On Fri, Jan 15, 2010 at 10:00 AM, Ben Bolker <bolker at ufl.edu> wrote:
> John Kane <jrkrideau <at> yahoo.ca> writes:
>
>>
>> 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. :)
>>
>
> Those are all good reasons.
> I have said something similar before
> (see <http://www.mail-archive.com/r-help@r-project.org/msg16904.html>),
> but I tend to use = because it seems to be more intuitive for
> students, despite being logically confused at a deeper level,
> and I want to spare them any additional cognitive load when they
> are first getting introduced to R.
> I'm not particularly convinced by the "<- is more general
> and there are some contexts where = doesn't work", because I'm
> not trying to be absolutely rigorous, nor teach all the possible
> ins and outs of R syntax. I would be very surprised if any of
> the examples given actually came up in the course of a first-semester
> statistics/modeling R course.
I teach the idiom
summary(fm1 <- lm(y ~ x, mydata))
in my introductory courses.
> I just want to do what works best for
> the students -- the problem is deciding on the balance between
> short term benefit (<- is one more odd thing to get used to)
> and long term benefit (they will see <- in other contexts, so
> they might as well get used to it eventually).
>
> Ben Bolker
>
> ______________________________________________
> 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.
>
More information about the R-help
mailing list