I am struggling to find a way to capture the assignment name of a new object initialized in R. Below is a very simplistic example with some pseudo-code to demonstrate my problem.
f <- function(){
print(nameOfObject)
}
# I would like the following to be returned
a <- f()
[1] "a"
I have poked around in the docs but I have only figured out how to get the name of an 'object' passed in to the function as opposed to the name of the new object. Not sure if this is possible.