Sharing your code and plots with slides

We live in slide times.

An ever-increasing portion of our knowledge is deposited on those horizontal decks, usually written in really unreadable 8-point characters.

Even if criticism on the bad use of slides is growing (see, for instance, the great book Presentation Zen by Garr Reynolds) at the moment, you will still have to face that fatal request, “Could you prepare a deck on that job you have done?."

So, why miss the opportunity to do it directly within your coding best friend, RStudio?

Here, I will show you how to prepare a nice deck of slides within the IDE, leveraging the R Markdown language once again.

How to do it...

  1. Create a new R Markdown presentation:
    How to do it...
  2. Preview your slides.

    You can preview you slides through the knit HTML control on the upper bar or simply by using Ctrl + Shift + K.

  3. Add a logo to your slides:
    ---
    title: “slides”
    author: “Andrea Cirillo”
    date: “27 February 2016”
    output:
      ioslides_presentation:
        logo: aclogo.png
    ---
    
  4. Enable and add captions to your figures.

    Enabling captions on figures involves specifying it within the metadata of your slides, where we put the logo source path. The caption option is specified using the following code:

    fig_caption: yes

    You can now add a caption to a figure, making it explicit within the chunk containing the plot, as shown in the following chunk:

    ```{r pressure, fig.cap = “pressure plot”}
    plot(pressure)
    ```
    
  5. Save your slides as portable HTML.

You can render your slides through the knit HTML control on the upper bar or simply by using Ctrl + Shift + K.

Once your slides are rendered, hit the Open button in the browser, and when in the browser, save your page. This can be done with cmd + S on Mac and Shift + F12 on Windows.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset