How Shiny’s invalidateLater() actually works

Shiny’s invalidateLater() function, if you know about it at all, probably doesn’t work the way you think it does. Moreover, the way it actually does work, it turns out, is way cooler than the way it appears to work!

Continue reading “How Shiny’s invalidateLater() actually works”

Adding anchors to our Shiny button observer

In my previous post, I demonstrated a JavaScript / jQuery event handler that waits for button clicks and sends the id of the button that was clicked to a single observeEvent() in Shiny. In this post I’m going to improve that code while also extending it to include anchor tags (<a id="xxx">). Anchor tags are typically used to create links and include an href attribute that holds the URL of the linked document.

Continue reading “Adding anchors to our Shiny button observer”

One observer for all buttons in Shiny using JavaScript / jQuery

One of the profound limitations of Shiny is the way it supports buttons. Buttons are based on a function called actionButton(). When a button is clicked, Shiny reports the click on input$button_id. Every button has to have a unique id, which means that each button also has to have its own observer to watch for a click. But what if you want to do something like this:

Continue reading “One observer for all buttons in Shiny using JavaScript / jQuery”

How to configure nginx and shiny-server for a LEMRS stack

My last post included an Amazon Lightsail launch script to set up an instance with a LEMRS (Linux / EngineX (nginx) / MySQL / R / Shiny-Server) stack. This time we’re going transfer files into the instance, including new configuration files for nginx and shiny-server, start both of them up, and see how they work.

Continue reading “How to configure nginx and shiny-server for a LEMRS stack”

Launch script for a LEMRS stack on Amazon Lightsail

In my last post I talked about the strategy I used to figure out what should go into a LEMRS launch script. A major theme of this post is that I now know more about Linux than I ever have before and ever will again, so I’m trying to document what I’ve done and otherwise take care of future me when I have to get back in and update all this stuff. [NOTE: There is now an updated version of this script.]

Continue reading “Launch script for a LEMRS stack on Amazon Lightsail”

Multi-page, URL-based Shiny web site skeleton with authentication

Today I’m releasing v0.1 of om_skeleton. It begins where uiStub left off, but now includes user authentication – that is, logging in and logging off.

In other words, om_skeleton is R code for Shiny-server-based web sites that allows multiple pages (the code for each of these pages is in a separate file) and multiple users. The users can:

Continue reading “Multi-page, URL-based Shiny web site skeleton with authentication”

Demo app.R for multi-page, URL-based Shiny web sites

As I mentioned in the final post of my read-me-first Shiny tutorial, the need for a ui variable makes Shiny look like it requires a separate app for every distinct web page. But if you reduce the ui to a stub that has only what you want to be the same on every page of your web site, you can move the rest of each page into the server function.

Continue reading “Demo app.R for multi-page, URL-based Shiny web sites”

Creating linked GitHub, RStudio, and projects

Staying organized is a bitch. Using a separate RStudio project for each distinct task you’re working on is a core organizational principle that works on its own for statistical projects related to classwork or publications. Things get harder, however, when your RStudio project also has a GitHub repository and is a Shiny app hosted on a server like

Continue reading “Creating linked GitHub, RStudio, and projects”

MySQL remote access setup in cPanel

Inexpensive shared servers, like the one is using, include MySQL database software that you might be able to access from other servers or computers. But when you try to look up how to do this, you are likely to get instructions that are out-of-date and that appear more complicated than the process actually is.

Continue reading “MySQL remote access setup in cPanel”

See your shiny app inside WordPress with iframe embedding

In the last paragraph of my And how… post I mentioned using iframes to display something from another web site embedded inside this one. Here’s a sample of what this might look like, although in actual use you’d hide the red border. Here I display it so we can see the dimensions of the iframe and where it’s positioned on the page.

Continue reading “See your shiny app inside WordPress with iframe embedding”