docdata is an R package that generates documentation for datasets semi-automatically. It streamlines the process of documenting when/where/who etc. a dataset is from. It also standardizes documentation.

Ideally, every dataset (e.g., csv/txt file) with tabular data should have a corresponding documentation file that describes the rows and columns of that dataset and other information about the dataset. docdata helps you accomplish all that.

docdata aims to make data docmentation and sharing easier. It helps you avoid being that person who shares data that no one else can use because nothing was documented.


Below are examples of documentation generated by docdata:


To install the package, type the following commands into the R console:

# install.packages("devtools")
devtools::install_github("hauselin/docdata") # you might have to install devtools first (see above)

How to use docdata?

Step 1: use doc_data() to generate a documentation (markdown file)

Step 2: use disp_doc() to print the doc in your console

Step 3: use doc_open() to open the doc to edit it

Step 4: use doc_refresh() to refresh/update your documentation

Step 5: share your dataset and documentation file with others or your future self(!)

Step 3: doc_open()

doc_open() opens the documentation in R or RStudio so you can edit it and fill in the details.

Example usage: doc_open("mtcars.csv") or doc_open("")

Step 4: doc_refresh()

If your documentation looks messy after you’ve edited it (especially if the description column isn’t aligned), run doc_refresh() to clean it up. Or if the columns/rows of your dataset have changed since the last time the documentation was generated, run this function again to update your documentation, which merges your previous documentation with a refreshed/updated one.

Example usage: doc_refresh("mtcars.csv") or doc_refresh("")

  • Before (messy)
  • After running doc_refresh(): spacing are cleaned and new columns are deleted/added

Step 5: Share your dataset + documentation