How to convert variable (object) name into String [duplicate] How to convert variable (object) name into String [duplicate] r r

How to convert variable (object) name into String [duplicate]


You can use deparse and substitute to get the name of a function argument:

myfunc <- function(v1) {  deparse(substitute(v1))}myfunc(foo)[1] "foo"