Hi all,
is there a way to extract the name of a function, i.e. do the reverse
of match.fun applied to a character string? I would like to print out
the name of a function supplied to another function as an argument.
For example:
myFunc = function(x) { x+1 }
applyFunc = function(fnc, x)
{
fnc
On Wed, Aug 29, 2012 at 3:36 PM, Peter Langfelder
peter.langfel...@gmail.com wrote:
Hi all,
is there a way to extract the name of a function, i.e. do the reverse
of match.fun applied to a character string? I would like to print out
the name of a function supplied to another function as an
On 12-08-29 04:00 PM, Peter Langfelder wrote:
On Wed, Aug 29, 2012 at 3:36 PM, Peter Langfelder
peter.langfel...@gmail.com wrote:
Hi all,
is there a way to extract the name of a function, i.e. do the reverse
of match.fun applied to a character string? I would like to print out
the name of a
deparse(substitute(fnc)) will get you part way there.
myFunc - function(x) x + 1
applyFunc - function(fnc, x) {
cat(fnc is, deparse(substitute(fnc)), \n)
fnc - match.fun(fnc)
fnc(x)
}
applyFunc(myFunc, 1:3)
fnc is myFunc
[1] 2 3 4
applyFunc(function(x)x*10, 1:3)
fnc is function(x)
On Wed, Aug 29, 2012 at 4:14 PM, William Dunlap wdun...@tibco.com wrote:
deparse(substitute(fnc)) will get you part way there.
...
I like to let the user override what substitute might say by
making a new argument out of it:
applyFunc(function(x)x*10, 1:3)
fnc is function(x) x * 10
[1] 10 20
On 30/08/12 10:36, Peter Langfelder wrote:
Hi all,
is there a way to extract the name of a function, i.e. do the reverse
of match.fun applied to a character string? I would like to print out
the name of a function supplied to another function as an argument.
For example:
myFunc = function(x)
6 matches
Mail list logo