Fortunately, life in
R hasn't settled down into warring camps over the one-true-way to handle this type of task. There are some frameworks and a lot of different opinions as to their relative merits. I can tell you what I do and why.
Everything lives in the file system under a directory
projects. I begin by creating a
github repo with a README file and clone it from the
projects directory. I'll create a project in RStudio from its directory.
All R code lives under an
data subfolder contains incoming data without any preprocessing. If it was hard to come by, it has read-only permissions.
If I have shell scripts, or compiled programs, they go in
All processed data goes into
obj (for object), usually in Rds form.
All documents except README go into
doc. Readme is used as a notepad, lab log, whatever.
Everything gets pushed to github at the end of each session.
For coding, I have a script,
libr.R with all of the libraries I anticipate using,
func.R with functions, so I don't have to hunt for them. Other scripts begin with
This approach occupies the middle ground between a one-off and the scale of effort that calls for a package or requires close collaboration. I have a set of naming conventions that I use with it to facilitate code reuse.
This all is working for me and will stop at some point and I'll adopt or invent something else. The main thing is to cut down on what has to be thought over again and again.
| symbol | default |
| 137 | a seed argument |
| a | a temporary object |
| b | a temporary object |
| c | prohibited symbol – not used |
| d | a dataframe or tibble |
| dte | a dataframe |
| e | anything |
| f | a function |
| g | an inner function |
| h | an inner function |
| hs | a hash |
| i | an iterator |
| j | an iterator |
| k | an iterator |
| l | a list |
| m | a matrix |
| n | a count |
| o | an output object |
| q | a queue |
| r | a rep |
| s | a sample |
| sq | a sequence |
| ss | a subset |
| t | prohibited symbol – not used |
| tsib | a tsibble |
| tib | a tibble |
| u | an unknown value placeholder |
| v | a vector |
| w | an argument |
| x | an argument |
| y | an argument |
| z | an argument |