I actually was just about to post something on these forums asking the same thing. Mainly because I was reading Advanced R and ran into the following lines:
(Note that if you’re using RStudio, refs() will always return 2: the environment browser makes a reference to every object you create on the command line.)
and
When refs(x) is 1, modification will occur in place. When refs(x) is 2, R will make a copy (this ensures that other pointers to the object remain unaffected).
http://adv-r.had.co.nz/memory.html#modification
So it seems like you'll always make a copy when doing things in RStudio, but it's interesting that you found that running all at once in RStudio will do modification in-place. I wonder why that is / why it would matter? Does RStudio no make its environment references until all the lines queued to be run are completed?