Perhaps I should add to
my post about FreeFormatter. I noted
that manual conversion of R code for inclusion in
web pages is a pain because of the assignment
symbol, <-
. But I feel
I should say that
assignment can also be written as
=
, though this sometimes clashes with
=
for named function arguments.
Kun Ren gives an example in
“Difference
between assignment operators in R”. John
Mount in
“Prefer
=
for assignment in R” prefers
=
, saying that if you’re accustomed to
typing <-
, you might type it
by mistake in named function arguments too, causing
a bug. But David Smith in
“Use
=
or <-
for assignment?”
argues for <-
.
And Bob Rudis in
“A Step to the Right
in R Assignments” argues for
yet another permitted symbol,
->
, because it
fits better with the Tidyverse’s
“pipes” notation, wherein functions
are composed from left to right. In
engineering, there is never one right answer.