On 28/09/2009, at 12:34 PM, Gabor Grothendieck wrote:

Not sure if this is important to you but R functions don't have to
have names so what you get back won't be a name if the function was
anonymous.  In the example below an anonymous function calls fname and
the returned string is the calling sequence but that's not its name
since it has no name.  In fact, in a sense no R functions have names.
You can store them in variables and call that variable its "name" but
that is not an intrinsic part of the function itself.  A function is
just an environment, an argument list and a body -- no name.

fname <- function() as.character(sys.call(-1))[1]
(function() fname())()
[1] "(function() fname())"

        <snip>

Good point.  Thanks.  I don't ***think*** that this issue will call
problems for me.  In my real application ``bar()'' will always be
called by a named function.  Still, it's something to keep in mind.

        cheers,

                Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to