Re: [R] Obtaining argument name within a function

2005-07-18 Thread John Sorkin
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 ne

Re: [R] Obtaining argument name within a function

2005-07-18 Thread Sebastian Luque
"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)) > } > > myfu

[R] Obtaining argument name within a function

2005-07-18 Thread Francisco J. Zagmutt
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"