Dear all
How can I obtain the name of the argument passed in a function? Here is a
simplistic example of what I would like to obtain:
myfunction= function(name) {
print(paste(The parameter name was,unknownFunction(name))
}
myfunction(myobject)
[1] The parameter name was myobject
Francisco J. Zagmutt [EMAIL PROTECTED] wrote:
Dear all
How can I obtain the name of the argument passed in a function? Here is a
simplistic example of what I would like to obtain:
myfunction= function(name) {
print(paste(The parameter name was,unknownFunction(name))
}
Francisco,
I had exactly the same question a few days ago. Try the following:
z-function(x)
{
xName - deparse(substitute(x))
cat(xName)
cat(The parameter name was ,xName,\n)
}
Let me know if this works.
n.b. the \n in the cat function is a signal to print the next piece of
data
on the next