3

In Advanced R, Hadley Wickham writes

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).

But also

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.

Does that mean that in RStudio, R will always copy data, and never modify it in place, because refs() will always return 2?

Hatshepsut
  • 5,962
  • 8
  • 44
  • 80
  • Since the environment browser only captures symbols at the top level, it seems like R's memory copy behavior within functions or other closures would not be affected. – Martin Morgan Jun 08 '16 at 11:44
  • 1
    Related: [Operator “[<-” in RStudio and R](http://stackoverflow.com/questions/15559387/operator-in-rstudio-and-r). – Henrik Dec 10 '16 at 11:29

0 Answers0