[R] assign using =

Kevin E. Thorpe kevin.thorpe at utoronto.ca
Mon Jun 27 17:57:06 CEST 2011


On 06/27/2011 10:34 AM, Berry Boessenkool wrote:
>
>
> Hey all,
>
> I learned that using the equals sign "=" to assign objects is generally OK, but will not work in some cases.
> As I always use "<-" for assignments, I have not encoutered any problems.
>
> Could somebody provide an example or explanation, why getting used to "=" is not a good idea?
> Or is it?
>
> Thanks ahead,
>
> Berry
>

As a top-level expression, it probably doesn't matter too much.  I 
always use <- myself.  Here is an example where = does not equal <-

print(fit <- lm(...)) is very different from print(fit = lm(...)).


-- 
Kevin E. Thorpe
Biostatistician/Trialist,  Applied Health Research Centre (AHRC)
Li Ka Shing Knowledge Institute of St. Michael's
Assistant Professor, Dalla Lana School of Public Health
University of Toronto
email: kevin.thorpe at utoronto.ca  Tel: 416.864.5776  Fax: 416.864.3016



More information about the R-help mailing list