powered by
This function tries to determine the name of a variable passed to a function.
function
variable_name(variable, fallback = "unnamed")
A character, the variable name.
character
Any object.
A character, a fallback if for some reason the actual variable name (which must be a single character) cannot be determined.
variable_name(a) f <- function(x) variable_name(x) f(x = a)
Run the code above in your browser using DataLab