Uploading data file for Shiny App on shinyappio

Hi.

I'm completely new to this Community and shinyappio.

I have an app which works perfectly locally. It loads Excel data and interactively produces graphs. Not very complicated. I have a shinyappio account and can see how to upload ui and server files to form the app, but everything seems to assume I'd know how to upload the data file. I know I might have to do it in csv or Rdata (which is OK, I can do all that), but how do I actually upload it to the site?

I've searched several communities (github etc), and everyone just assumes people know how to upload. The RStudio help on shinyappio is good, but nothing clear on how to upload.

Thanks in anticipation,

Ian

When you press "publish app" you get to select which files to upload, just select the csv or xlsx file along with your app.R file (or ui.R and server.R files).
Also, don't forget to use relative paths inside your code to reference those files, if you use absolute paths your app is not going to work when deployed because the absolute paths are not going to be valid on the server.

1 Like

Thanks so much.

I hadn't tried to upload the app itself, as I didn't see the point in trying until I knew how to upload the data. Chicken and egg.

The introductory document "Shinyapps.io - Getting started" only mentions hitting the publish button - there's no mention at all that it gives you the option to upload data, nor, AFAICT, does it mention uploading your data files? It mentions about linking to servers with data, but I can't do that.

Thanks again,

Ian

I've deployed the app, apparently successfully (at least, as far as shinyapp.io is concerned), but no graphs. Perhaps I didn't get what you meant by relative paths? I'd assumed that all the files would be installed into a default working directory on the server, so I removed all file paths and just referenced the file name in both ui.R and server.R. For example load("AllInds.Rdata"). All works fine once I've setwd appropriately on my PC.

Ian

P.S. I guessed that when I tried to deploy using deployApp() it failed to upload the data file, but absolutely no way of telling and none of the documentation even gives a clue. Not terribly impressed with shinyapps.io, particularly the documentation. Given the trouble Iv'e heard trying to install Shiny Server, I doubt I'm up to this. May just have to give up.

1 Like

Log states:

2020-03-18T12:05:22.475630+00:00 shinyapps[1961579]: Disabling weekly seasonality. Run prophet with weekly.seasonality=TRUE to override this.
2020-03-18T12:05:22.476031+00:00 shinyapps[1961579]: Disabling daily seasonality. Run prophet with daily.seasonality=TRUE to override this.
2020-03-18T12:05:22.500051+00:00 shinyapps[1961579]: Compiling model (this will take a few minutes...)
2020-03-18T12:05:22.500387+00:00 shinyapps[1961579]: If this is the first time fitting a model since package install, this is normal. You should not see this message more than once after install.
2020-03-18T12:05:22.501101+00:00 shinyapps[1961579]: Writing model to: /opt/R/3.6.3/lib/R/library/prophet/libs
2020-03-18T12:05:22.501432+00:00 shinyapps[1961579]: Compiling using binary: /opt/R/3.6.3/lib/R/bin
2020-03-18T12:06:13.848750+00:00 shinyapps[1961579]: 111: rstan::stan_model
2020-03-18T12:06:13.752856+00:00 shinyapps[1961579]: Warning in system(cmd, intern = !verbose) :
2020-03-18T12:06:13.752858+00:00 shinyapps[1961579]: running command '/opt/R/3.6.3/lib/R/bin/R CMD SHLIB file182442a154.cpp 2> file182442a154.cpp.err.txt' had status 1
2020-03-18T12:06:13.841169+00:00 shinyapps[1961579]: Warning: Error in sink: invalid connection
2020-03-18T12:06:13.848747+00:00 shinyapps[1961579]: 113: sink
2020-03-18T12:06:13.848750+00:00 shinyapps[1961579]: 110: compile_stan_model
2020-03-18T12:06:13.848749+00:00 shinyapps[1961579]: 112: cxxfunctionplus
2020-03-18T12:06:13.848751+00:00 shinyapps[1961579]: 109: fit.prophet
2020-03-18T12:06:13.848751+00:00 shinyapps[1961579]: 108: prophet
2020-03-18T12:06:13.848752+00:00 shinyapps[1961579]: 107: func [/srv/connect/apps/weekly_deaths/server.R#45]
2020-03-18T12:06:13.848752+00:00 shinyapps[1961579]: 94: origRenderFunc
2020-03-18T12:06:13.848752+00:00 shinyapps[1961579]: 93: output$timePlot
2020-03-18T12:06:13.848753+00:00 shinyapps[1961579]: 13: runApp
2020-03-18T12:06:13.848753+00:00 shinyapps[1961579]: 12: fn
2020-03-18T12:06:13.848777+00:00 shinyapps[1961579]: 7: connect$retry
2020-03-18T12:06:13.848778+00:00 shinyapps[1961579]: 6: eval
2020-03-18T12:06:13.848779+00:00 shinyapps[1961579]: 5: eval
2020-03-18T12:06:14.143468+00:00 shinyapps[system]: Out of memory!

Not sure what to do about that?

Ian

You are using more RAM memory than the amount available for your shinyapps.io account (you could upgrade to a bigger plan). It seems like you are using RStan, have in mind that this usually requires a considerable amount of RAM memory.

I'd guessed as much, but my analysis requires it. Not too impressed that something that runs on my PC won't run on their server. I'm not upgrading to a paid account before I've even been able to see how this works. I could pay and it could still fall over. This is not a business venture, it's a voluntary activity. Thanks for the advice. I think I'll just send anyone else who's interested the files and tell them to install R etc.

Much simpler for all concerned.

Ian

It would actually run, just not on the free plan, all free cloud computing services I know have this 1GB RAM limitation.

I wouldn't know. I don't use this sort of service, just OneDrive for storage. I'm retired and this is voluntary work, so can't really afford to pay.

Can't be sure it would work on the Starter Plan and the next one up is quite big money, maybe £3-400/year.

You could try to slim your deployment by making all heavy calculations in advance and just uploading pre processed data when possible.
I haven't used RStan but I would guess is possible to save trained models and load them afterwards

Thanks for suggestion. I've tried the Starter Plan, and it still falls over.

I'm not really using RStan directly, but the forecasting package, Prophet (very powerful and very simple) uses it.

It would be a complete re-write of what should be simple app.

The app works for me - no idea anyone else will want it.

Starting to think Shiny isn't worth the effort if it's so much trouble to deploy. I could make do with rMarkdown.

Life's too short. I've already spent about 2 days on this.

Thanks,

Ian

Have you change the configuration for your app after upgrading? You have to manually set resources.

Shiny is a very powerful tool, and it is not that hard to deploy apps, it just takes some time to get use to it.

Manually set resources? I've no idea what that means.

I already know how to reliably produce the data visualisation I want, quickly. Making it available to other people using Shiny and shinyapps.io seems to be a whole different scale of work (now with £s), when it's sold as being simple. You say it's not that hard to deploy, but it's turning out that way for me. Either complete re-write (with new learning on how to handle arrays etc) and then learn all about setting resources. And all to publish something I've no idea whether anyone will want.

I think not.

I admire you dedication.

Thanks again,

Ian

Go to the settings tab and increase the instance size

Mate, it's maxed out at 1Gb within the Starter Plan. I'm not spending $49/month on this hobby.

Thanks for trying, but this technology and I aren't up to this.

We're both wasting our time.

I'm sorry I've wasted yours.

Bye,

Ian

I'm not trying to convince you, if it doesn't feet your needs you shouldn't use it. I'm making clarifications mostly to avoid misleading someone else that might stumble across this post.

Thanks again for being helpful.

Bye.

For what it's worth, I seem to have been able to get this working. However, it has required a total re-write of the app, to undertake all the computing in advance, but generating lots of small data files for the app to select based on user input. Almost certainly more efficient computationally/overall, but tedious and error prone. As the data change each week, this will mean processing, generating and uploading 34 files every week. Now seems to work on Starter Plan (may well work on free version, I'll test next month, when I unsubscribe form Starter to see).

My advice, don't upload anything that uses Prophet and/or RStan, and make your app to be efficient from the start.

But, mainly, expect everything to take five times as long as you thought.

Ian

Just as a comment, is very likely that you can automate this part by scheduling a script, that is a very common workflow.