O'Reilly logo

Data Analysis with R - Second Edition by Tony Fischetti

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

What in the world are by reference semantics?

In order to properly extol the virtues of setorder and understand the price we pay for it, we need to discuss what it means to modify a structure by reference as opposed to by value. This is a somewhat advanced topic but I feel that it is essential for (a) learning how data.table is so powerful and fast, and (b) preventing you, dear reader, from corrupting your data accidentally. In addition, the material in this discussion introduces concepts and terms in computer science that will serve you well to know for programming in other languages.

Most R programs use expressions that use by value semantics.

Here’s an example code.

Let’s make a two copies of mtcars, called mtcopy and mtcopy2, using the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required