QR Codes

Overview



This application is a small example that highlights how to integrate the {qrcode} package πŸ“¦ into shiny.

This might at first seem trivial β€” β€œjust generating a QR code?” β€” but when paired with the right information, QR codes can actually become a powerful way to communicate data and metadata πŸ“¦

For example, imagine embedding metadata about how a figure was generated β€” the selected Shiny inputs, slider values, and filters applied. That’s instant context. String interpolation is your friend here 🎯

Try it yourself πŸ‘‡ by scanning the QR with your πŸ“ž

🧩 Data and Metadata Examples



You can easily enrich your QR codes with:

πŸ•’ System information: date, time, session ID

πŸ‘€ User info: pulled automatically (e.g., session$user in Posit Connect)

πŸ“Š Data provenance: source files, query timestamps, or version numbers

When your app runs on Posit Connect, this becomes even more useful β€” you can automatically tag content with who generated it and when via the session object.

πŸ’‘ Why It Matters



On a more thematic level, QR codes offer a new layer of tractability in your analytics workflow. If your app generates outputs β€” say, plots or reports β€” you can encode contextual details about the data source or analysis parameters directly into a QR code.

It’s like leaving a digital breadcrumb trail for reproducibility 🧡

🧱 Where to Use Them



QR codes are super flexible β€” you can insert them into:

πŸ“ˆ Plots via {ggplot2} or {patchwork} (e.g. inset, or adjacent)

πŸ“„ Documents (PDF, DOCX, PPTX) using {officer}

πŸ–₯️ Directly inside your Shiny app’s UI


πŸ”— Resources



If you find creative uses οΈπŸ’‘ for them, I’d love to know about it. Be sure to also check out the other features of the {qrcode} package:




Till next time, 🍻🌴
Matthew Kumar
Matthew Kumar
Associate Director, Lead Computational Scientist

Related