November 2017
Intermediate to advanced
262 pages
4h 34m
English
© Thomas Mailund 2017
Thomas Mailund, Functional Data Structures in R, https://doi.org/10.1007/978-1-4842-3144-9_3
Thomas Mailund1
(1)Aarhus N, Denmark
What prevents us from implementing traditional imperative-language data structures in R is the immutability of data. As a general rule, you can modify environments—so you can assign to variables—but you cannot modify actual data. Whenever R makes it look like you are changing data, it is lying. When you assign to an element in a vector
x[i] <- vthe vector will look modified to you, but behind the curtain, R has really replaced the vector that x refers to with a new copy, identical to the old x except for element number i. It tries to do this efficiently, so it will ...
Read now
Unlock full access