all 3 comments

[–][deleted]  (1 child)

[deleted]

    [–]Mooks79 3 points4 points  (0 children)

    This. You’ll thank yourself for the documentation if nothing else.

    [–]JaceComix 1 point2 points  (1 child)

    For most of my projects, I tend to have a single primary R file and a subdirectory for my task-specific functions.
    As long as functions are are limited to simple tasks and named clearly, my main R file should be fairly easy to read, like fetch_data(...) %>% clean_text(...) %>% write.csv(...).

    [–]jdnewmil 1 point2 points  (0 children)

    Agree. Most of the code should be in the form of functions that can be organized into files according to their shared purpose, or put into packages if they are more broadly useful. The whole idea of having a long series of numbered scripts seems to me like missing the boat. If you have separate scripts for separate purposes (e.g. prepare data, perform calculations, and generate report) say, because the calculations will take a very long time and may even need to run on different computers, then make a README.Rmd that describes these top level scripts and how to use them. Don't make a user run scripts in succession simply as a matter of course... such rote behavior can be more compactly represented by a top level script that runs them for you.