I have a large object in my R environment declared as, say, X. Now, I would like to remove that object from my environment in order to make space in memory for another large object, say, Z created by some function, say, Y. In my mind, I have two ways to do this. I can remove X first and then create my new object: Z <- Y(..). Or, instead of calling my new object Z, I can call it X: X <- Y(..). The latter way basically replaces the old object with the new.
Now to my question, If I were to apply the latter method does R first remove X before applying function Y to create the new object or does R create the new object first and only then removes the old object?