For example:
A <- 1:10
B <- A
Both A and B reference the same underlying vector.
Before I plow off and implement something in C…
Is there a function in R which can test whether two variables reference the same underlying object?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the
.Internalinspectfunction:Simon Urbanek has written a simple package with similar functionality. It’s called… wait for it… inspect. You can get it from R-forge.net by running:
UPDATE: A word of warning:
I recommend you use Simon’s package because I’m not going to recommend you call
.Internal. It certainly isn’t intended to be used interactively and it may very well be possible to crash your R session by using it carelessly.