[R] Precision for a former question*

Duncan Murdoch dmurdoch at pair.com
Mon Jun 7 18:22:19 CEST 2004


On Mon, 7 Jun 2004 16:08:58 +0200, "zze-PELAY Nicolas FTRD/DMR/BEL"
<nicolas.pelay at rd.francetelecom.com> wrote :

>I got many answers to the question I asked below , and I thank you all.
>Several of you told me to use ->> but told also that "it is not a
>recommendable way of items manipulating in R".
>I don't really understand what it exactly means :
>	1) does it mean it's not a very good way of programming , a
>dangerous way of programming because the variable a can be modified ? ,
>etc
>Or 	2) does it mean that R is not done to manipulate the operation
>->> in a function in a safe way , that  there can be some mistakes, that
>the memory allocation is not forseen for this case?

I think it's dangerous in the first sense.  It's best to try to
contain the effects of functions as much as possible, avoiding side
effects like a change to a variable outside the function.

Something else that hasn't been mentioned is that <<- is different in
R and S-PLUS, so it may come to haunt you if you ever try to port your
code there.

Duncan Murdoch




More information about the R-help mailing list