How do I access the name of the variable assigned to the result of a function within the function in R? -


for example, suppose able define function returned name of assignment variable concatenated first argument:

a <- add_str("b") # "ab" 

the function in example above this:

add_str <- function(x) {   arg0 <- as.list(match.call())[[1]]   return(paste0(arg0, x)) } 

but arg0 line of function replaced line name of variable being assigned ("a") rather name of function.

i've tried messing around match.call , sys.call, can't work. idea here assignment operator being called on variable , function result, should parent call of function call.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -