Workflow w/ reports package

[This article was first published on TRinker's R Blog » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

NOTE: THIS IS NOW A PACKAGE SEE THIS LINK FOR DETAILS

Let me start with a video for people who just want to see what I’m demo-ing first:

I’ve been interested in speeding up workflow lately and spending a lot of time doing so. I’ve seen people already try to tackle this in R in the past.  This blog post covers many aspects of workflow and increasing productivity.  John Myles White has tackled this problem and created the ProjectTempalte package.  The idea is terrific but the problem is that the R user is so varied in their work flows that it’s difficult to make one workflow template for everyone.  I’ve given up on that.  Instead I propose:

1. The R community modularize workflow into field dependent pieces.

For instance in qdap, an R package for quantitative discourse analysis, I’ve added a work flow template that people in my field would find suiting.  However, the report writing part I intentionally left underdeveloped because I plan to add the reports package as a piece of the workflow.  While my entire work flow is likely only useful for discourse analysis people, the reports section is much more generalizable.  In this way we build work flow from modular pieces.

2. Make the pieces flexible (within reason).

For example in the beta version of reports I have added the ability for users to submit templates via doc_temp (not sure how well this will work) which provides a template that alters the documents that the new_report template will generate. The doc_temp function is similar to package.skeleton.  The functionality will be similar to the way CRAN or CTAN house packages with the templates library housed within the package, provided it doesn’t get to large. The submissions still need to conform to a standard (the within reason part) though the user may choose to keep their template local.

3. Use existing tools (powerful, flexible and efficient).

R has had some great developments in tools, combined with latex, we can really speed up workflow; RStudio, knitr, MikTex/Tex Live, bibtexknitcitations and of course R to name a few.  By utilizing all these tools we really maximize productivity in that we’re not going to multiple places and reloading libraries and user defined functions.  As an example, recently, R bloggers Daniel Liidecke and Andrew Landgraf discussed custom functions that they use frequently .  By placing these in the extra_functions.R script and then opening with RStudio, the project’s .Rprofile will source these functions automatically and load them as well just by opening the project. Better still if these are constantly used functions that don’t yet have a package home the user can supply the path(s) to new_report and the code will be added automatically to the report project’s .Rprofile for sourcing.

The idea is to generate a template that is fast and flexible which keeps everything for a report housed in one place.  In this way the report framework of the reports package can be added as a piece to the rest of your workflow.

Trying the reports package

 #INSTALLING
library(devtools)
install_github("reports", "trinker")

#GETTING STARTED
library(reports)
# setwd("~/your/favorite/directory/here")
new_report("New")

#PLAY AROUND A BIT
templates()   #current internally housed templates

new_report("new proj2", templates(FALSE)[2]) #quantitative Rnw
new_report("new proj3", templates(FALSE)[3]) #qualitative docx

I encourage you to view the intro video, look at the help manual, check out the html5 introductory slides and just play with the reports package a bit.  I want your feedback to make a tool others can use to help them in their work flow. If your comments are more substantial please use the Issue Tracking of GitHub.


To leave a comment for the author, please follow the link and comment on their blog: TRinker's R Blog » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)