You’re staring at your assignment, hands hovering over the keyboard, and all you can think is: “What on earth does ‘pass by value’ mean in R? Why do my variables keep changing when I copy them? And what’s this about pointers—doesn’t R handle memory for me?” If that’s you, trust me, you’re not alone. I’ve been there, stuck for hours, convinced I understood variables and memory... until my code started behaving in ways I couldn’t predict.
This is the story of how a single R assignment finally helped me get it—and how you can too.
Why R’s Memory Model Feels So Weird
If you’ve programmed in Python or Java before, you might expect R to behave the same way when you assign variables.…