Shiny button observer update: ignoring clicks on disabled buttons

In earlier posts, I’ve explained how to add a bit of JavaScript/jQuery code to your project that lets you have one Shiny observeEvent() handler for all your button and anchor clicks. This week I needed disabled buttons, which are easy to do visually by adding the Bootstrap disabled class to the button. But the buttons still responded to being clicked.

Continue reading “Shiny button observer update: ignoring clicks on disabled buttons”

How to source a mysqldump file with syntax statements

MySQL provides an external program called mysqldump that writes a file full of MySQL syntax statements that will recreate a database’s tables and their contents. Back in the Apple II days this kind of file was called an exec file. Windows calls them batch files and Linux calls them shell scripts, of which one common format is the bash file. You can create the same thing with HeidiSQL by right-clicking on the database you want to save or duplicate and selecting Export database as SQL.

Continue reading “How to source a mysqldump file with syntax statements”

Why is my logical && comparison producing NA?

Who knew? I thought the difference between & and && for ANDing logical vectors in R was just that & evaluated the whole expression while && started at the left and went right until it hit a FALSE value. But there’s more. & is vectorized, but && only considers the first value in a vector and only returns a single value.

Continue reading “Why is my logical && comparison producing NA?”

Let’s put the whole Tidyverse on Amazon Lightsail (LEMRS v0.3)

The Tidyverse is a collection of related R packages, many of which I use on Open-Meta. I recently added the entire Tidyverse to my Windows-based development system, which meant I had to do the same to move that code to my Amazon Lightsail instance, which I did yesterday.

Continue reading “Let’s put the whole Tidyverse on Amazon Lightsail (LEMRS v0.3)”

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”

Adding RStudio to an Amazon Lightsail Instance

Today I decided to try adding the RStudio Server to my Amazon Lightsail instance. There are three steps to this – downloading and installing the software, opening up port 8787, and adding a user with a password who can log in to the server.

Continue reading “Adding RStudio to an Amazon Lightsail Instance”