As Christian’s answer with assign() shows, there is a way to assign in the global environment. A simpler, shorter (but not better … stick with assign) way is to use the <<- operator, ie
a <<- "new"
inside the function.
As Christian’s answer with assign() shows, there is a way to assign in the global environment. A simpler, shorter (but not better … stick with assign) way is to use the <<- operator, ie
a <<- "new"
inside the function.