[R] Using Object's Name in Function

Ko-Kang Kevin Wang kwan022 at stat.auckland.ac.nz
Mon May 6 11:18:19 CEST 2002


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.

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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list