Discussion: when is Shiny a good choice vs when is it not the right tool for the job?

thanks Jonathan! I'm going to look into it in the next few days and will let you know how it goes.

I want to echo on that you can solve a lot of problems without a hosting server.

I've trying to deliver a shiny app without hosting to users without experience on R or programming.

  • My app is in github
  • I used pacman to load packages in shiny, which will install needed packages in first time automatically.
  • I wrote a r script to install some packages better handled before the first run, then run the app from the github repo directly.
if (!require("devtools"))
  install.packages("devtools")
devtools::install_github("rstudio/shiny")
devtools::install_github("ctmm-initiative/ctmm")
devtools::install_github("r-lib/crayon")
# run app
shiny::runGitHub('ctmm-initiative/ctmm-webapp')
  • All user need to do is to install R, then run one line in R (RStudio is not required)
source("https://raw.githubusercontent.com/ctmm-initiative/ctmm-webapp/master/run.R")
  • You can update your app and data, and user don't need to do anything special.

I think this process is automized as much as possible. It's possible to create installers but that will be platform specific.

The above method can also be used if you use a private server instead of github.

6 Likes

That is an awesome solution! I have a Linux laptop myself (love it). Installing R is where many of my users get hung up. You could create a batch file and a desktop icon which runs the source call above. That way people don't need to save the code for the future :wink:

Hi,

I am working with a fintech startup based out of India. We were able to utilize shiny opensource to create an enterprise BI portal catering to about 150 users, and the server utilizes upto 20 GB of data in global memory per shiny App. We were able to make the application response time fast (~ 5 seconds for the largest of the source tables in data.table format and ~1 second for 80% of the user queries). We were even able to integrate a pivot self service mechanism with optimal use of data.table in the backend and appropriate UI in the front end.

The pain points and lessons learnt:

  1. Using shiny for enterprise BI applications increases the maintenance overhead for data teams gradually. You stop spending time on data analysis and instead become more of a R "Application Developer" catering to dashboard maintenance and additional scripting for charts/enabling interactivity etc. Data analysts have to own the application because IT and production support teams do not know R.

  2. The sequential request execution by Shiny increases response time for the nth user, if there are high number of concurrent users. Of-course this depends on the data volume to be processed at the backend as well. But this will ultimately put a limit on the number of users who can utilize the dashboard for a given server configuration.

  3. Even with shiny server pro, to overcome limitation of point 2, an app thread gets duplicated X times basis user limit set in server configuration file, which increases RAM utilization by a factor of X for global in memory data replication. Not desirable in enterprise scenarios. You can avoid this by not using In-memory but directly sending the data processing load to Data warehouse / data lakes, but this requires a lot of scripting associated with development as well

  4. As your application complexity increases you will be spending more time scripting charts etc in R etc. instead of data analysis and inference communication to end users

  5. Considering the above points, now we are migrating to PowerBI where we have GUI based development mechanism and R integration for advanced analytics

Suggestions for R shiny team ( This is my individual opinion and not necessarily a correct one)

  1. While the team is working on solving problems like asynchronous execution etc.. it is also time to put effort on a drag and drop tile based UI creation framework on top of R shiny. That will help you to improve R shiny usage and adoption by a wider audience. There can be integration options for parametrized R functions to enable custom functionalities or decision tree charts etc. Organizations will be happy to pay for such a tool, as this will help to significantly improve productivity of data teams in delivering content to end users.

I am proficient in R and python. I will be happy to contribute to develop such a framework for the open source version if an experienced shiny team member is willing to guide on the same.

Thanks and Regards,
Jeganathan Velu.

14 Likes

Thank you for sharing your struggles. My organization's looking into Shiny, too, so this really helps.

Coincidentally, we're leaning toward Power BI; I even suggested it over Shiny. Like you mentioned, it's nice to have more control over the presentation, but creating and maintaining an app requires analysts to have an unreasonable amount of skill.

However, I'm still not a big fan of Power BI. It's a Microsoft product, so it employs the usual "walled garden" behavior. That makes difficult to fit in an automated analysis or reuse pieces in other projects. And using version control with the massive binary file just leads to problems.

I'd like to see a dashboard framework where IT and analysts work together. That's the natural way: IT handles databases, interfaces, and security; and analysts work with data and share results in those systems. R wasn't written for managing state-based applications. Let IT use whatever's the flavor of the month for that, and let the analysts write R scripts that do the number-crunching and graph-drawing behind the scenes.

And let it work with Git.

2 Likes

@dracodoc Very interesting approach, thanks for sharing! To @paul's question on delivering Shiny apps in the lack of a hosting environment or enough R users / Shiny apps to justify one, I would think that Docker (specifically, it's easy to start with the rocker project) might be an acceptable way to deliver Shiny applications. No install of R necessary - if you have Docker installed, you can run it. If you build the app sufficiently atomic, they could even run multiple instances. Everybody seems to be itching for Docker these days, so "I'm going to give you a Docker image" might go over nicely in some places :slight_smile:

To @nwerth's point, you can also use plumber to create APIs with R code so that other applications can call out to the R code for number-crunching and graph-drawing in a more "application-y" way. That way you don't have to convince them to install R on the same server the app backend is running on, and so you can fit into their new-age Docker infrastructure (EaaS... everything as a service).

6 Likes

Pros:

1> very easy for R users to create a prototype dashboard
2> excellent for prototyping
3> excellent for creating desktop apps inside your organization
4> automating some workflows in organization
5> fast enough for most of the jobs if you use( proper sql, data.table and dbplot and other tools..)

cons:

1> very hard to add extra functionality that is not already there in some package.
2> No package for login , security and stuff...
3> relatively hard to integrate plots and dashboard with one another in comparison to powerBI and tableau.
4> very hard to build even a CRUD application I tried but couldn't built it the right way
(Building CRUD with Shiny)

Things I wish it had:

1> A Secure login Page to build in Shiny
2> A CRUD application package.

3 Likes

I disagree with all of your "cons".

  1. the shinyjs package allows you to incorporate javascript directly into your application and you could use reticulate or Rcpp if you wanted to incorporate python or C++. You state that this is "very hard" and I would agree it would be hard if you are not familiar with those languages, I am not sure what other platform would make this "easier" apart from you personally being more familiar with them. To make a blanket statement that it is very hard seems subjective and potentially misleading
  2. There are examples of people implementing this in the free version (although if I remember correctly, it is done using javascript which goes back to point 1) but the "easy" way to do this is to pay for one of the Pro versions of shiny server, which has authentication built in
  3. I am not sure what you mean by this, as integrating plots is a major feature of shiny and is limited only by a users familiarity with a given graphics library. As for dashboards, there are several packages for creating dashboards for shiny (shinydashboard, flexdashboard, semantic.dashboard)
  4. Again, this blanket statement that it is very hard to build is relative to your familiarity with the R language and the syntax of the shiny package. From the link you post, it looks like Barbara gave you a link to a CRUD shiny app that she built, so it is clearly possible. In addition, simply googling "CRUD app R" came up with several links showing how to build the kind of app you are looking for. (here, here, and here)

While i completely understand that it can be frustrating when you are trying to learn a new language/package, to make blanket statements about it being "very hard" as cons on an open forum will likely discourage new users from trying if they see this. The documentation for shiny is very extensive, and all of the things you mentioned can be implemented in shiny and while I imagine the learning curve is probably steeper than point-and-click alternatives (tableau), once you get over that learning curve, you will be able to do more with shiny then with the point-and-click alternatives.

12 Likes

I am really very sorry, I didn't think I was discouraging somebody. I just wrote what I felt like that's the reason I didn't use the word can't but I used hard instead (which you thought is blanket :rofl: )

Before I say anything let me share an experience. I wrote a few Rinno apps for my team but just because I couldn't provide login facilities to it. I had to hand it over to an IT person who is efficient in python. He created all those for me. He even created CRUD part of database.

In my defence.

  1. I know no other language but sql and r. So I couldn't use js or c++ for CRUD or login. And it's very easy to add buttons on a bootstrap layout. But in shiny dashboard I have to go through js again (How to create this user panel on top right corner of shiny).

  2. And it's very easy in powerBI to group data so that it can be browsed in just a click. That's why I said relatively hard. I didn't say is not possible.

I don't mean to belittle anybody I think if these basic steps would be improved. New bees like me would have an easier time navigating.

Thanks for pointing things out to me. I was just sharing my views and I even wrote a list of pros too..:grin:

2 Likes

I'll throw into the mix that you're comparing a free open-source R package to software services like tableau and powerBI that cost tens, if not hundreds of thousands of dollars in licencing costs to use in a commercial environment.

The beauty of shiny is that it's completely open to integration with other technologies, unlike off-the-shelf software. If you have the skills and knowledge to build and deploy your app with your own login system then you can do it. Otherwise RStudio offers commercial software that will take care of that for you, as @tbradley mentioned .

Same goes with every other aspect of a shiny app. If you don't want to use any of the many pre-built UI frameworks, you can build your own from scratch, but you have to know front-end web-development with HTML, CSS and JS.

For me, the great part of learning shiny, starting from a point of no data-engineering or front-end knowledge, has been the exposure I've gotten to these other technologies. So as well as learning the reactive programming principles of shiny and R, I now know a lot about back-end stuff like cloud servers and docker as well as front-end html and css.

It's a steep learning curve but you'll begin to see the benefits and possibilities very quickly. And I think businesses should invest in their people's expertise rather than tableau or microsoft.

6 Likes

Totally agreed

Thanks for the great tip.

Seems like can not skip learning js anymore :sunglasses:

I'll say that I've been learning JS for some data visualisation projects, and it complements R really well—both in terms of the way the two languages work and in how your knowledge can benefit the communication of your data science :slightly_smiling_face:

1 Like

Just to add on what I suggested above.

today I wrote a shiny app and it worked fine in the beginning and then I think I changed some parameters and even used a ctrl+f to replace some values and in the middle of all this I messed it up. I spent entire day trying to get it work again.

I wish It had auto-reloading something like I change the function in shiny and I could see it live update on shiny app. With this feature we could be more product and debugging would be lot easier.

I am not sure if it's implementable or not. But just saying that this could improve workflow a lot. If I don't have to close the app and change the code and then run it again and then close it and then change the code and so on and so forth...

I am not sure if you can relate to it. But shiny errors don't really make much sense to newcomers like me...:grinning::grinning::grinning::grinning::grinning:

@Anantadinath, you can try options(shiny.autoreload = TRUE). It's not perfect though; the autoreload will fail if your UI is broken so badly that it fails to render at all (Shiny at least needs the connection to the server to succeed for autoreload to work).

Also, feel free to make new posts if you have additional thoughts. This thread is all over the place already! :slight_smile:

6 Likes

Oh, and in case you're not aware, in RStudio you can just hit Ctrl+Enter to launch or reload Shiny (if the current file you're editing is an app.R, ui.R, or server.R). So you should just be able to edit, Ctrl+Enter, edit, Ctrl+Enter...

4 Likes

:star_struck::star_struck::star_struck:

Thanks for such a great tip. I will give it a try for sure.

Thanks a lot