[R] R and pointer
Henrik Bengtsson
hb at maths.lth.se
Fri Aug 29 15:46:24 CEST 2003
Three references that are of interest (the two first are related to the
idea of using environments to do the job):
[1] http://www.maths.lth.se/help/R/ImplementingReferences/
[2] http://www.maths.lth.se/help/R/R.oo/
[3] http://www.omegahat.org/OOP/
All of the above are written in the light object-oriented programming,
but from [1] you quite easily get what is needed for just emulating
"pointers". Be careful though as R is a functional language.
Best wishes
Henrik Bengtsson
Lund University
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Jeff Gentry
> Sent: den 29 augusti 2003 14:34
> To: Laetitia Marisa
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] R and pointer
>
>
> > I want to write a function that modify directly variables passed as
> > parameters (the equivalent in C language of *ptr/&ptr) so
> that I don't
> > have to return a list and to reaffect all my variables. Is
> it possible
> > to do so in R? Thanks a lot.
>
> You can use environments as they're passed by reference.
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo> /r-help
>
>
More information about the R-help
mailing list