Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't modify all the references #2

Open
privefl opened this issue Jun 6, 2018 · 0 comments
Open

Don't modify all the references #2

privefl opened this issue Jun 6, 2018 · 0 comments

Comments

@privefl
Copy link
Owner

privefl commented Jun 6, 2018

If many names point to the same object, they will be all modified, which is not the default behaviour of base R.

(X <- runif(4))
X2 <- X

X %*<-% 2
X
X2

I wanted to use something like x[1] <- x[1] + 0L to make a copy of x if multiple names referred to the same objects in memory so that the other are not modified.
Yet, in RStudio, there are references (due to the object explorer?) so that I would make copies all the time.

See https://community.rstudio.com/t/in-place-modification-doesnt-work-in-rstudio/9407?u=privefl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant