Suppose I have create a list in R and append to it as follows:
x = list(10)
x[[2]] = 20
Is this equivalent to
x = list(10)
x = list(10, 20)
? I'm not so experienced with the particular details of how R handles lists in memory, but my limited understanding is that it tends to be copy-happy; what would be ideal for me would be that the first option doesn't involve essentially creating another list in memory, but just results in setting aside a new place in memory for the appended value. Essentially, if I have a big list, I don't want R to make another copy of it if I just want to append something to it.
If the behaviour I want is not what is given here, is there any other way I can get the desired effect?