s-news
[Top] [All Lists]

Re: generating function arguments as string

To: <Ronan.Bradley@ILIM.COM>
Subject: Re: generating function arguments as string
From: "Dimitris Rizopoulos" <dimitrios.rizopoulos@student.kuleuven.ac.be>
Date: Mon, 19 Jul 2004 15:19:54 +0200
Cc: <s-news@lists.biostat.wustl.edu>
References: <946C68E53B08A84283BD1639AF350BBA2EB87A@ilife118.ilim.com>
Hi Ronan,

do you want something like,

f.test <- function(x,y=6){
 call <- match.call()
 return(list(result=x*y, Call=call))
}

f.test(2)

I hope this helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Doctoral Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/396887
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
     http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm



----- Original Message ----- 
From: <Ronan.Bradley@ILIM.COM>
To: <s-news@lists.biostat.wustl.edu>
Sent: Monday, July 19, 2004 2:55 PM
Subject: [S] generating function arguments as string


>
> Hi,
>
> I am using Splus 6 with Windows NT (soon to be migrating to XP). I
want to
> find a way of storing my exact function call as a string. For
instance if my
> function is like so
>
> f.test(x,y=6)
> {
>  return(x*y)
> }
>
> I want a way of generating "x=2, y=6" when I call f.test(x=2)? I
want to do
> this so I can attach the details of the function call to the output
of
> functions so I know exactly how they were generated. I don't think I
can
> using the "..." form in my functions because alot of the arguements
are
> supplied by default much in the same way that y=6 is specified in
the
> function call above.
>
> Regards,
> Ronan Bradley
>
>
>
>
>
**********************************************************************
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please
notify
> the system manager.
> This footnote also confirms that this email message has been swept
> for the presence of computer viruses.
>
**********************************************************************
>
> --------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu.  To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu
with
> the BODY of the message:  unsubscribe s-news



<Prev in Thread] Current Thread [Next in Thread>