Hi,
This is a dangerous game you are playing. I would play with the call
stack, i.e sys.calls :
setMethod("fun","character",
definition = function(y,x,...){
stack <- sys.calls( )
stack.fun <- Filter( function(.) .[[1]] == as.name("fun"), stack )
nameO
Hi all,
In a function, I need to get the name of a variable that has been used to
call the function.
For example, I want:
--- 8< --
toto <- 3
fun <- function(y){
nameOfY <-deparse(substitute(y))
cat("name is ",nameOfY)
}
fun(toto)
# [1] name is toto
--- 8<
But deparse(substitut
2 matches
Mail list logo