Skip to main content

Pretty Good Hat

Sharing a quick tip that I’ve found useful while building with Shiny, recently: It’s handy to be able to save off the current state of a data set for bringing over to a scratch file. I made the download link appear only when running in my local environment. This way I can easily snapshot my in process data set for experimenting with visualization in my scratch file.

In ui.R:

    if(interactive()) {
      downloadLink("downloadData", "💾️ Download data set") 
    }

And in server.R:

    output$downloadData <- downloadHandler(
      filename = function() {
        paste("shiny-export_", Sys.Date(), ".csv", sep="")
      },
      content = function(file) {
        write.csv(globaldata$armor, file)
      }
    )

A TV in a dark room showing a video game character standing on a high platform overlooking a valley

🎮 Now that I’ve finished Citizen Sleeper, maybe I’ll head back to my long-time Destiny hobby, but maybe … Elden Ring!

A red cocktail in a rocks glass, beside a macbook on a wooden counter

I was in the mood for a Negroni, but only had dry vermouth so I improvised. Friends, the maple syrup Negroni is pretty darn good.

Screenshot displaying rows of armor items and their stat values

Screenshot showing a scatterplot of stat values for a selected armor configuration

I’ve had a nice afternoon working on my hobby R/Shiny project, a loadout finder for the game Destiny 2. These improvements make it a lot more flexible and informative: It can now optionally include armor that would otherwise be filtered out of configurations by the minimum stat threshold, and it will show current mods used in displayed loadouts.

ArmoreR: A Destiny 2 Loadout Finder

I’m sure it poses some benefits for systematic parsing (and I’m certainly much more comfortable working in R and markdown, for what it’s worth) but Jupyter’s reliance on json for its file format seems like a big disadvantage for readability and portability.