[R] Using Object's Name in Function

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon May 6 14:47:43 CEST 2002



Ko-Kang Kevin Wang wrote:
> 
> Hi,
> 
> Suppose I have a function:
> myfunc <- function(x, y) {
>  ...
> }
> 
> And within the function I want to print out the name of the x, y
> vectors.  For example, if I do:
> > myfunc(foo, goo)
> [1] "foo" "goo"
> 
> It shall return "foo", "goo" (with or without quotes is fine), where foo
> and goo are two vectors with numbers.


Try substitute().

Uwe


> I know this sounds strange, but I'd like to use it for debugging purposes.
> 
> Cheers,
> 
> Kevin
> 
> ------------------------------------------------------------------------------
> Ko-Kang Kevin Wang
> Postgraduate PGDipSci Student
> Department of Statistics
> University of Auckland
> New Zealand
> 
> Homepage: http://www.stat.auckland.ac.nz/~kwan022
> 
> E-mail: kwan022 at stat.auckland.ac.nz
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list