ShinyApps.io and Dropbox

1,246 views
Skip to first unread message

Philipp Maier

unread,
Aug 30, 2014, 7:00:01 AM8/30/14
to shiny-...@googlegroups.com
Hi,

For an application hosted on ShinyApps.io, I'd like to build a data set using data from quandl and/or other online data sources. To make sure the data set is always up-to-date, I'll be refreshing it periodically. This part is easy.

Now, suppose I want to track what data is available over time, or the output of some calculations over time, based on the data available at that point. Usually, I would simply save my data set (or, say, a tracking table), but I don't think that anything can be saved and updated regularly on ShinyApps.io. I could imagine, though, that it could be possible to point the data file to a Dropbox account and load and save a data file from there.

My question is: has anyone been able to accomplish this (yet)? Any pieces of code anyone has to share that would show how to do this?

Thanks, Philipp

Carlos Sánchez

unread,
Sep 9, 2014, 8:22:19 AM9/9/14
to shiny-...@googlegroups.com
Hi Philipp,

I was intrigued by your email and I was able to build an app which is hosted in Shinyapps.io and reads the data from a Dropbox account.

The only modification I needed to include was in my global.R file.

Let's assume you were doing a simple:

load("mydata.Rdata")

Following this comment on SO


You need to replace the above line by something like:

library(httr)

# Getting the data from DROPBOX !
response <- GET(url = "<Link to DROPBOX file>")
load(rawConnection(response$content))

Hopefully, this will help you out.

Carlos

Philipp Maier

unread,
Sep 10, 2014, 10:14:15 PM9/10/14
to shiny-...@googlegroups.com
Genius! It works!!

Philipp Maier

unread,
Sep 15, 2014, 10:44:13 PM9/15/14
to shiny-...@googlegroups.com
Actually - let me modify my previous statement. Thanks to Carlos' suggestion I can now read data from a Dropbox account right into a shiny app (hosted on ShinyApps).

But, ideally, I'd like to save some output to a file as well. And that's really where I'm having a lot of trouble. I've tried using rDrop, but for some reason I can view files on my Dropbox account, I can read them, but I cannot write to Dropbox. I've been thinking about AWS, but I have zero experience with it... so not sure I can get it to work easily.

Has anyone ever had success in storing some output from a shiny app on Dropbox or AWS? If so, I'd appreciate any (additional) pointers...!

Many thanks, Philipp


Philipp Maier

unread,
Sep 16, 2014, 4:41:21 PM9/16/14
to shiny-...@googlegroups.com

Ok,

I *think* I got it to work. I've re-installed rDrop, I re-did the authentication, and for no obvious reasons, where it previously wouldn't work, it now seems to do the job flawlessly, and my file is saved to the Dropbox folder. Now, every time I run my model code, I get a notification from Dropbox that my file has been modified, which I take is a good sign.

If anyone's interested, this is the project I've been playing with:


Here is the code on Github:


Note that this is still in a VERY early stage, and clearly still needs a lot more work. Right now I'm just exploring different possibilities, without focusing too much on the data presentation, the forecasting models etc. But, if anyone else wants to use Dropbox, you might get some clues from the code.

Philipp
Reply all
Reply to author
Forward
0 new messages