When you are busy with a lengthy project, like writing a paper, you create many objects along the way. Every time you log into the project, you need to remember what is what. In the past, each new working session I used to rerun the script anew and follow what each line is doing until I get back the objects I need and continue working. Apart from helping you remember what you are doing, it is very useful for reproducibility, at least given your data, in the sense that you are sure nothing is overrun using the console and it is all there. Those days are over.
Advanced statistical procedures nowadays are:
(1) Heavy, time and CPU hungry.
(2) Worth the trouble.
You will not wait 8 hours every time you re-connect with your previous session. A solution is to save the objects and to load them into the workspace each session. But then, how do you remind yourself what is what? To make it easier to return to work after referee reports come back (which can take a while..), you can attach comments along the way:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
# An object x <- array(dim = rep(5,3)) # Attach a comment comment(x) <- "This is a 5*5*5 array. The dim1 stands for.., dim2 for.. and dim3 for.." # Save it save(x,file = "Path/x.RData") # Break period of 8 months and come back load("Path/x.RData") comment(x) "This is a 5*5*5 array. The dim1 stands for.., dim2 for.. and dim3 for.." |
An extended version is to write the actual code that generated the object along with some more things you think you may forget into a COMMENTS.txt file. Once done, attach the COMMENTS.txt file as a comment like so:
comment(x) <- readLines("path/COMMENTS.txt", warn = F)
This allows more extensive description and code attachment without cluttering the actual script.