This is an experimental R package that provides a jquery Knob html widget for R.
You can install it from github.
library(devtools)
install_github('rstudio/htmltools')
install_github('ramnathv/htmlwidgets')
install_github('htmlwidgets/knob')Let us first create a simple knob.
library(knob)
knob(value=20, min=0, max=100, angleArc=250, angleOffset=-125, fgColor="#66CC66")We can also use it in a Shiny application.
library(shiny)
library(knob)
ui= shinyUI(fluidPage(
sliderInput('value', 'Value', 0, 200, 50),
sliderInput('angleArc', 'Arc Angle', 0, 360, 250),
knobOutput('gauge')
))
server=function(input, output){
output$gauge<- renderKnob(knob(
value=input$value,
min=0,
max=200,
angleArc=input$angleArc,
fgColor="#66CC66"
))
}
shinyApp(ui=ui, server=server)The knob package makes use of the htmlwidgets package that makes it super-simple to package any HTML widget for R. Please read this to get a better sense on how the htmlwidgets package can make your life easier!

