Author: Ruoqi Huang

Why documentation for psych-related projects?

You maybe starting your programming task as a research assistant, or you have your first brainhack— in that case, you and your collaborators may have a bunch of codes. Throughout the project, you keep writing functions, codes, but then, when communicating with your collaborators, you suddenly failed to recall what the specific function was about. Because you forgot about it, your discussion paused, and you may have to spend hours to trace back what it was about.

Awkward, eh?

To avoid incidents like this, and also to help you get more organized, I would strongly suggest you to start documenting your code.

Where to start?

  1. (Optional) Learn about markdown: https://developers.google.com/tech-writing/one/markdown
  2. Choose your tools for writing:
    1. R Markdown
    2. Notion
  3. Know the basics
    1. Function Name
    2. Title
    3. Description
    4. Usage
    5. Arguments

Why Notion?

Besides personal preference, notion is by far the most simple and intuitive way for documentation. Below I will show you the step by step guide I used, and I summarized document your codes. In addition, notion support online collaboration, can be exported to markdown files, and even publish. So it is also very easy for you to collaborate with others.

Notion step by step guide to write documentation

What you need:

Your written code, in whichever language 🙂

Steps:

First, copy and paste your function name. put ##+ space in front of the name for headline 2.

For title, ****briefly describe your function, put ###and a space in front of the name for headline 3.

For description, ****describe your function, the inputs and outputs, remember to mention return if the function returns anything, put ##and a space in front of the name for headline 2.

For usage, copy and paste both your function name and the subsequents arguments, for R, keep the default values of the arguments if there are any. Put ````` in front of the first character of the code to make it a code, then select the corresponding language you are using.

Lastly for arguments, for each of the argument, write a simple sentence for each of them. Make sure to state what they are (data frame, variables, labels, etc.) For each of the arguments them self, select them and press ctrl/cmd + E