[R-sig-teaching] The pedagogy of the assignment operator
Murray Jorgensen
maj at waikato.ac.nz
Wed Oct 27 02:41:13 CEST 2010
I can see that I am going to have to set a little context because I
wanted to anchor the discussion in the teaching of statistics, and not
of R as a language. I think the issues are different in the two. One big
problem in the former is that symbols can engender fear in the students.
A few years ago I was taken off the teaching of a large first year
business statistics course. The clinching incident in this decision
mentioned by my then chairperson was the use ( in a side-discussion ) of
the mathematical summation sign ( upper-case Greek sigma ). I don't
think my chairperson was wrong. In the context of that course what I
should have done was illustrate my point with a column of data in an
Excel spreadsheet.
If \Sigma upsets business students with its suggestion of abstract
mathematics, I think many other statistics students find <- somewhat
suggestive of abstract logic or theoretical computer science, favourite
subjects of an epsilonic proportion of the large classes I used to teach.
I teach smaller classes now and my students come to me with previous
exposure to Minitab which uses = for assignment. I use = both to avoid
any of the symbol-fear that I spoke of, and also because they are used
to how assignment works in Minitab. (For maybe half of the students,
Minitab would be the only computer language that they would have met.)
I will come clean and admit that I have another reason for not liking R.
The symbol <- suggests the right-to-left direction of the assignment
strongly and appropriately. But I read from left-to-right and I get
startled by an arrow coming at me from the unseen future and feel a
second or two of cognitive dissonance.
I actually rather like the right-pointing -> assignment as the
directions of reading and of computation agree. It would be a bit
idiosyncratic to use it in code though. I find it useful in interactive
R when I have typed and evaluated a complex expression and realise that
I really should have assigned it to something. After the up-arrow key ->
lets me do the needed assignment on the right of the expression.
Murray
On 27/10/2010 12:59 p.m., Gabor Grothendieck wrote:
> On Tue, Oct 26, 2010 at 3:10 PM, Murray Jorgensen<maj at waikato.ac.nz> wrote:
>> Greetings all,
>>
>> in my own R code I have used various forms of the R assignment operator at
>> different times in my life. There are arguments for and against each choice.
>>
>> A question I would like this sig is whether there are any specifically
>> teaching reasons for preferring one form over another?
>>
>> A second question, mainly to clarify the first, is whether different forms
>> might be preferred for different types of student?
>>
>> Awaiting responses with interest - Murray
>
> <- is less error prone so you always want to use that. It might be
> argued that there are only a few cases where it matters but if you run
> into one of those cases you will be sorry you did not standardize on
> using<- .
>
--
Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html
Department of Statistics, University of Waikato, Hamilton, New Zealand
Email: maj at waikato.ac.nz majorgensen at ihug.co.nz Fax 7 838 4155
Phone +64 7 838 4773 wk Home +64 7 825 0441 Mobile 021 0200 8350
More information about the R-sig-teaching
mailing list