Reproducible Research in R

Ilya Kashnitsky

14 December 2016

Reproducible research

Reproducibility

  • Reproducibility of scientific results is the main challenge of the modern academia
  • Collaboration, Open Science (2015). Estimating the reproducibility of psychological science. Science, 349(6251), aac4716. https://doi.org/10.1126/science.aac4716
  • Out of 100 papers only 39 were replicated

Literate programming

  • The idea of literate programming dates back to mid-80s
  • The core idea: code, comments, and results should appear together in one document.

Peng, R. D. (2011). Reproducible Research in Computational. Science, 334(6060), 1226–1227. https://doi.org/10.1126/science.1213847

peng

markdown

What is markdown?

Markdown is a lightweight markup language with plain text formatting syntax designed so that it can be converted to HTML and many other formats using a tool by the same name.

Where is it used?

  • Everywhere
  • Reddit
  • StackOverflow
  • github
  • Publons
  • Habrahabr
  • …

The basics of markdown

  • Basically, everything is just plain text unless modified
  • Be careful. There are n+1 versions of markdown.
  • The most popular are: GFM, rmarkdown and pandoc

http://rmarkdown.rstudio.com/authoring_basics.html

Task

Create a webpage using markdown.
Use as many markdown options as you can think of. Include image, gif, video, link…

http://txti.es
10 minutes

The author of txti, Barry T. Smith, is a great advocate of lightweight websites
http://motherfuckingwebsite.com

rmarkdown

http://rmarkdown.rstudio.com

https://bookdown.org/yihui/bookdown/

R notebooks

  • The recently presented v1.0 version of RStudio brings R-notebooks as on of the main features.
  • This type of document implements the principles of literate programming.

http://www.danielwells.me/human-lifespan-limit/

Example

  • Please follow me on the Rmd script "161126-application-ik.Rmd"

Presentations with R

Easy and impressive

impress

Numerous frameworks for creating presentations with R

http://rmarkdown.rstudio.com/formats.html

https://ramnathv.github.io/slidifyExamples

My choice: revealjs

http://lab.hakim.se/reveal-js/

Advantages of HTML5 presentations

  • Open in any browser
  • Put online
  • Dynamic fit to screen (4:3 or 16:9 ?)
  • Animated contents
  • Fast to create
  • Enforce KISS

http://rmarkdown.rstudio.com/revealjs_presentation_format.html

Example

  • Please follow me on the Rmd script "161209-R-ggplot.Rmd"

What’s next?

swirl

http://swirlstats.com

Coursera: Data Science

https://www.coursera.org/specializations/jhu-data-science

R-bloggers

https://www.r-bloggers.com

I believe, that it is the right time for you to master R while writing your master thesis.

Thank you