In my work, I create many informal exploratory analysis scripts in R to try out ideas. Most of these are "single use," but sometimes I have trouble finding the right code months or years later when it turns out the approach I took is relevant again.
Beyond using a descriptive file names, are there any good practices I should adopt? What are good ways to improve the "searchability" of my code snippets, either at the time of creation or as a periodic "curation" step?
For functions that I use regularly, it has worked out quite well to put them in packages, that's quite easy to create with {devtools}, and you can keep documentation and tests available with little effort. But of course a lot of exploratory scripts don't fit into functions.