Paul Baer
2005-Oct-06 02:43 UTC
[R] Changing the value of variables passed to functions as arguments
Is it possible to write functions in such a way that, rather than having to write "a=function(a)", one can just write "function(a)" and have the variable passed as the argument be modified? My real interest here is being able to invoke the editor by writing "ed(filename)" rather than filename=edit(filename). Thanks, --Paul
Gabor Grothendieck
2005-Oct-06 03:01 UTC
[R] Changing the value of variables passed to functions as arguments
Check out: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/38536.html On 10/5/05, Paul Baer <baer at stanford.edu> wrote:> Is it possible to write functions in such a way that, rather than > having to write "a=function(a)", one can just write "function(a)" and > have the variable passed as the argument be modified? > > My real interest here is being able to invoke the editor by writing > "ed(filename)" rather than filename=edit(filename). > > Thanks, > > --Paul > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >
Peter Dalgaard
2005-Oct-06 07:26 UTC
[R] Changing the value of variables passed to functions as arguments
Paul Baer <baer at stanford.edu> writes:> Is it possible to write functions in such a way that, rather than > having to write "a=function(a)", one can just write "function(a)" and > have the variable passed as the argument be modified? > > My real interest here is being able to invoke the editor by writing > "ed(filename)" rather than filename=edit(filename).You might want to check out fix()... -- O__ ---- Peter Dalgaard ??ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907