I’ve been thinking about building the {juxtaposer} package for a while, and have put together enough use cases and feature requirements that I’m confident the package should be a thing. In this post I’m going to break down these use cases and features in two ways:
- The usual “wouldn’t this be useful for an R user” way
- The business analyst way
Use cases
Comparing photographs
Journalists often use JuxtaposeJS to compare time periods by allowing readers to slide between two different photographs, like this great example comparing war-torn Berlin in 1945 and modern day (2015).
Did you know that originally Ancient Roman statues were painted brightly by their creators? I highly recommend the excellent New Yorker article on “the myth of whiteness in classical sculpture”.
Comparing dataviz
Choosing a good colour scale is difficult. Not only must the scale work well conceptually, it also needs to be readable by those with colour blindness. A vertically-oriented JuxtaposeJS widget is a great way to compare colour scale options.
Comparing Base R plot() vs {ggplot2} for the same dataset is another natural use case.
Comparing code (in training slides)
Often when writing code tutorials it’s convenient to compare one approach to another. Hadley Wickham’s little bunny foo foo example for demonstrating the advantages to using pipes works nicely as a JuxtaposeJS comparison.
Enter the Business Analysts
Several years ago I worked as a business analyst (BA). BAs are the folks responsible for requirements gathering, maturing requirements, and bridging the gap between client expectations and developer resources.
The best R packages are built with a BA mindset: a specific idea in mind, feedback used to mature the package, and a clear scope for extensions.
Requirements using MoSCoW
MoSCoW is a useful BA tool for feature prioritisation:
| MoSCoW | Description |
|---|---|
| Must have | The feature must be in the dev release |
| Should have | The feature must be in the first CRAN release |
| Could have | Scaffolding should be considered before first CRAN release |
| Won’t have | Added to issues log as an “enhancement” |
Requirements:
| User story | MoSCoW | Dev notes |
|---|---|---|
View {juxtaposer} widget in RMarkdown |
Must | Comes free with {htmlwidgets} |
View {juxtaposer} widget in Shiny |
Must | Comes free with {htmlwidgets} |
| Set custom slider colours | Must | Best approach: follow kableExtra::kable_styling() design — styles set in CSS |
| Click Shiny control to change images | Should | Most htmlwidgets use a proxy for updates; Issue #3 |
| Click Shiny control to change slider position | Could | Extend juxtaposer_proxy() with juxtaposer_update_slider(); Issue #4 |
Upload two images via juxtaposerInput() control |
Won’t | Sketch in Issue #5 |