Closed timelyportfolio closed 7 years ago
Here is a very ugly sketch.
spk_chr <- function(
values, ..., width = 60, height = 20,
elementId = NULL, renderSelector = NULL
){
if(inherits(values, "sparkline")) {
spk <- values
} else {
spk <- sparkline(
values = values,
width = width,
height = height,
elementId = elementId,
renderSelector = renderSelector,
...
)
}
as.character(as.tags(spk))
}
In nearly all of the examples in which I combine
sparkline
withdplyr
, I used the patternIt seems like we could provide a helper function
spk_chr
(unsure of name but think it should be short for easy typing) that accepts the same arguments assparkline()
but returnscharacter
instead of anhtmlwidget
. I think this usage will become more popular withformattable
andDT
especially considering RStudio's new notebooks.Thoughts??