Giter Club home page Giter Club logo

justgage's Introduction

justGage

This is an experimental R package that provides a justgage html widget for R. It is more or less a rewrite of the justgage package using the htmlwidgets package, that reduces the amount of code required considerably by providing generic plumbing to build upon.

Installation

You can install it from github.

library(devtools)
install_github('rstudio/htmltools')
install_github('ramnathv/htmlwidgets')
install_github('ramnathv/justGage')

Usage

Let us first create a simple knob.

library(htmlwidgets)
library(justGage)
k1 = justgage('My Gauge', 20, 0, 100, label = 'New')
k1

justgage1

We can also use it in a Shiny application.

library(shiny)
library(htmlwidgets)
library(justGage)
ui = bootstrapPage(
  tags$style('body{margin-left:40px; margin-top:40px;}'),
  sliderInput('value', 'Value', 0, 200, 50),
  justgageOutput('live_gauge', width = 250, height = 200)
)
server = function(input, output, session){
  output$live_gauge <- renderWidget(list(
    title = 'My Gauge',
    min = 0,
    value = input$value,
    max = 200
  ))
}

runApp(list(ui = ui, server = server))

justgage2

See Also

The justGage 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!

Credits

This package is highly inspired by the justgage package under development by JJ of RStudio. I have used several functions from his package, some verbatim, some with minor tweaks, aimed at providing the plumbing required to create HTML widgets with ease. I have also used some code from Winston Chang's shiny-jsdemo package on how to bind justgage with Shiny.

justgage's People

Contributors

ramnathv avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

justgage's Issues

problem installing

Hi,

I'm very interested in using your new package! Unfortunately during the install steps an error message appears:

Do you have any suggestion how to fix this?

kind regards, Herman
the Netherlands

install_github('ramnathv/justGage')
Installing github repo justGage/master from ramnathv
Downloading master.zip from https://github.com/ramnathv/justGage/archive/master.zip
Installing package from C:\Users\hsontrop\AppData\Local\Temp\RtmpCqDtc3/master.zip
Installing justGage
"C:/PROGRA1/R/R-311.1/bin/x64/R" --vanilla CMD INSTALL
"C:\Users\hsontrop\AppData\Local\Temp\RtmpCqDtc3\devtools13585fbf3299\justGage-master"
--library="C:/Program Files/R/R-3.1.1/library" --install-tests

  • installing source package 'justGage' ...
    ** R
    ** inst
    ** preparing package for lazy loading
    Error : 'widgetOutput' is not an exported object from 'namespace:htmlwidgets'
    Error : unable to load R code in package 'justGage'
    ERROR: lazy loading failed for package 'justGage'
  • removing 'C:/Program Files/R/R-3.1.1/library/justGage'
    Error: Command failed (1)

sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=Dutch_Netherlands.1252 LC_CTYPE=Dutch_Netherlands.1252 LC_MONETARY=Dutch_Netherlands.1252 LC_NUMERIC=C
[5] LC_TIME=Dutch_Netherlands.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] shiny_0.10.1.9002 devtools_1.5

loaded via a namespace (and not attached):
[1] bitops_1.0-6 caTools_1.17 digest_0.6.4 evaluate_0.5.5 htmltools_0.2.6 httpuv_1.3.0 httr_0.3 memoise_0.2.1 parallel_3.1.1
[10] Rcpp_0.11.2 RCurl_1.95-4.1 RJSONIO_1.2-0.2 stringr_0.6.2 tools_3.1.1 whisker_0.3-2 xtable_1.7-3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.