R's Copy-on-Modify in Practice: Reference Counting, ALTREP, and Avoiding Accidental Copies
R 3.5+ uses reference counting (REFCNT) and ALTREP to enable in-place mutation, but accidental copies still plague data-intensive workflows. Learn to detect copies with tracemem, exploit data.table and vctrs reference semantics, and avoid forced materialization of compact vectors.