Image source: pxhere

# Day 13: Sometimes I doubt my commitment to sparklines

The children are in bed. I am browsing the gallery of htmlwidgets. There is a sparkline widget. Sparklines look cute. I don’t know what I would use them for. I install it anyway. I load it.

library(htmlwidgets)
library(sparkline)

I look at the sparkline documentation. I create a few small data sets.

x <- rnorm(100)
y <- dnorm(seq(-3,3,length.out = 100))
h <- hist(x,plot = FALSE)\$counts
v <- seq(0,4*pi,length.out = 100)

I try some commands. They don’t work. I realise that because this is blogdown, my sparklines need to be wrapped inside a call to frameWidget. I try the commands again. They appear to work. I upload the post. They no longer work. I remove the references to frameWidget. I check the blogdown documentation. I create a custom footer. I add an exclude_jquery parameter. I modify the YAML header to the post. I upload again. Do my sparklines work?

• sparkline(x) becomes

• sparkline(y) becomes

• sparkline(x, type = 'box') becomes

• sparkline(x, type = 'box', lineColor = 'black', boxFillColor = 'white', medianColor = 'black') becomes

• sparkline(h, type = 'bar') becomes

• sparkline(1:3, type = 'pie') becomes

• sparkline(x[1:20], type = 'discrete') becomes

• spk_composite(sparkline(sin(v),fillColor=FALSE),sparkline(cos(v),fillColor=FALSE)) becomes

They are cute. I am pleased. But that was more work than it should have been. Sometimes I doubt my commitment to sparklines.