I am trying to create a function Append
that does not return a value but directly extend the first variable. Currently, to append y
to x
I do
x = append(x,y)
I would like to be able to do
Append(x,y)
and get the same result. I first thought of something like
Append = function(a,b,VarName) assign(VarName,append(a,b), envir = .GlobalEnv)
Append(x,y,"x")
It works but it is quite unsatisfying to have to pass the name of the original variable. Is there a better solution?