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

3

5

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?

Haleakala answered 12/9, 2013 at 9:42 Comment(6)
How sensitive? Who are you hiding it from? And pay no attention to those black helicopters landing in your front yardGyration
The previous two questions are serious -- how you encrypt something depends on how it needs to be handled. You seem to be mixing questions on security with questions on creating a package (e.g. zip) of all the files you want to transfer.Gyration
It has user identifiable information about their spending habits...it's not the kind of information you/we would want to get out in the public domain...Haleakala
In that case it should never leave your desk without first being heavily encrypted.Gyration
Well thats the whole point...i just want to encrypt the presentation file, and send it to a "safe" person who can decrypt it...and open/run the presentation...Haleakala
Slidify has a standalone option that serves all slide related assets from CDNs, converts figures to data-urls and essentially allows you to share a single index.html file. The catch is that they still need to be online to view the file. I will cook up an example that will show you how it works.Aquamanile
A
7

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')
```
Aquamanile answered 12/9, 2013 at 20:29 Comment(2)
I want to add that the slide folder approach works better from a security standpoint, since you can encrypt it. Using public scripts that are online allows someone to inject malicious javascript code that can compromise things. I still never understand why unzipping a folder and clicking on a file is that complicated, since most people do it all the time.Aquamanile
Thank you @Ramnath! I did not know about the include_assets = TRUE, cdn = TRUE arguments possibility. Is there any documentation or any easier way to find out about this stuff using str? or something without having to keep asking questions on SO or on your issues page?Haleakala
T
2

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.

Tour answered 22/12, 2013 at 22:39 Comment(0)
L
1

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

Lamellar answered 12/9, 2013 at 11:10 Comment(5)
Ah yes i didn't know about the HTML5presentations, but my slidify presentation does include the nvd3 libraries and the morrisjs libraries too...I forgot to mention that in the question but will add that in now...Haleakala
You could put the libraries on your dropbox and refer to the public link in your presentation html code?Lamellar
interesting...do you reckon you could show me a skeleton example of how that would be done?Haleakala
Just try to edit the index.html and change the library paths into the dropbox links?Lamellar
I believe slidify isn't so hard to figure out, and in the long run there is more to gain! If you check out the dev version of the package, you will find plenty of examples that are really impressive!Tour

© 2022 - 2024 — McMap. All rights reserved.