In Advanced R, Hadley Wickham writes
When
refs(x)
is 1, modification will occur in place. Whenrefs(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?