Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send/share sensitive R slidify presentation via email or other secure methods

I would like to send to someone else a presentation that I have created using R and slidfy, but it contains sensitive information, so putting it up onto github pages using the gh-pages branch and then sending the URL isn't really an option, since all github pages are public, as suggested here.

Pushing it up to the glimmer shiny server as well seems a bit unsecure too...(I would ideally like to do this for free so setting up a server to host the one presentation seems a bit cumbersome and overkill for my purposes)

I don't think dropbox would work either since any URL link that is produced if someone else types it into an address bar, would probably be able to download it and view the sensitive information...

Is there a way of sending the presentation (by email or other methods) that contains all the necessary files for it to work, so that a person who doesn't use R can open it and view it easily. (i.e. without having to send them a zip file of all the files (i.e. the assets and libraries and figure folders etc), asking them to unzip it and then opening the index.html file)?

Edit

I forgot to mention that the presentations include nvd3 and morrisjs graphs too, making it difficult to bring over all the files in one go...

Edit2

Given all the libraries used are public libraries, is there a way for it to reference a URL instead of a local drive?

like image 744
h.l.m Avatar asked Sep 12 '13 09:09

h.l.m


3 Answers

Here is how you would do it with Slidify. There are two tricks to use.

  1. Specify mode: standalone in your YAML front matter. This makes sure that all slide related JS and CSS assets are served from an online CDN, and also that all static images are converted into data URLs.

  2. Use n1$print('mychart', include_assets = TRUE, cdn = TRUE) when you print the chart in your knitr code chunk. This makes sure that all chart relate assets are included and served from an online CDN. Note that for each library, you should use include_assets only once, so that you don't duplicate.

  3. This approach is not very robust since you are linking to multiple JS libraries in a single file, and as a result there could be conflicts. Case in point, MorrisJS does not play well with Google IO2012, since Google IO2012 uses requireJS and for some reason raises conflicts.

You can also use the same code chunks in RStudio Presentations and save them as standalone HTML. Here is the same presentation in RPres format.

---
title       : Standalone Presentation with Slidify
author      : Ramnath Vaidyanathan
mode        : standalone
---

## Plain Text

This is a slide with plain text

> 1. Point 1
> 2. Point 2
> 3. Point 3

---

## R Plot

```{r message = F}
require(ggplot2)
qplot(wt, mpg, data = mtcars)
```


---

## NVD3 Plot

```{r results = 'asis', comment = NA, message = F, echo = F}
require(rCharts)
n1 <- nPlot(mpg ~ wt, data = mtcars, type = 'scatterChart', group = 'gear')
n1$print('chart2', include_assets = TRUE, cdn = TRUE)
```

<style>
.rChart {
  height: 500px;
}
</style>


--- 

## Another NVD3 Plot

```{r results = 'asis', comment = NA, message = F, echo = F}
require(rCharts)
n2 <- nPlot(mpg ~ cyl, data = mtcars, type = 'scatterChart')
n2$print('chart3')
```
like image 65
Ramnath Avatar answered Nov 16 '22 18:11

Ramnath


Another option is to

1) Open the HTML file in Chrome, 
2) Choose the option to print 
3) Save it as .pdf. 

It's not perfect for all cases but definately a decent option to consider.

like image 24
marbel Avatar answered Nov 16 '22 20:11

marbel


I think your last method is the safest.

Do you really want to use slidify? With the latest (preview) version of Rstudio you can create HTML5 presentations on the fly. And it is much easier than slidify. To distribute the slideshow you just have to mail the standalone output html file (if you aren't using fancy things like nvd3 or latex). Here is some more information. link1 link2 link3

like image 43
Jonas Tundo Avatar answered Nov 16 '22 18:11

Jonas Tundo