So there is a similar question on How to convert variable (object) name into String using deparse(substitute(variable))
but the solution doesn't work when variables are stored in a list.
Example :
# I want to convert mtcars into a string ("mtcars")
data(mtcars, Titanic)
li = list(mtcars, Titanic)
varName = deparse(substitute(li[1])) # "li[1]" instead of "mtcars"
thank you!