Nat  Grady

Nat Grady

1664274540

Rcdimple: Htmlwidgets for RCharts + Dimple

rcdimple | htmlwidget for dimple

rcdimple is the htmlwidget version of the dimple piece in rCharts. The goal is beautiful, customizable d3.js charts straight from R with minimal code and no knowledge of JavaScript. To get started, it is easy to install using devtools::install_github.

devtools::install_github("timelyportfolio/rcdimple")

Lots of Examples

Then for a complete replication of the examples in dimple, just do a demo.

library(rcdimple)
demo(dimple)

For additional discussion, see the post Week 11 | dimple as htmlwidget announcing this widget at Building Widgets. Look for many, many more examples in the future.

Waffle Charts with rcdimple

rcdimple already makes waffle charts by collaborating with waffle.

Download Details:

Author: Timelyportfolio
Source Code: https://github.com/timelyportfolio/rcdimple 
License: MIT license

#r #html #widgets #javascript 

What is GEEK

Buddha Community

Rcdimple: Htmlwidgets for RCharts + Dimple
Nat  Grady

Nat Grady

1664274540

Rcdimple: Htmlwidgets for RCharts + Dimple

rcdimple | htmlwidget for dimple

rcdimple is the htmlwidget version of the dimple piece in rCharts. The goal is beautiful, customizable d3.js charts straight from R with minimal code and no knowledge of JavaScript. To get started, it is easy to install using devtools::install_github.

devtools::install_github("timelyportfolio/rcdimple")

Lots of Examples

Then for a complete replication of the examples in dimple, just do a demo.

library(rcdimple)
demo(dimple)

For additional discussion, see the post Week 11 | dimple as htmlwidget announcing this widget at Building Widgets. Look for many, many more examples in the future.

Waffle Charts with rcdimple

rcdimple already makes waffle charts by collaborating with waffle.

Download Details:

Author: Timelyportfolio
Source Code: https://github.com/timelyportfolio/rcdimple 
License: MIT license

#r #html #widgets #javascript 

Nat  Grady

Nat Grady

1664294109

Exportwidget: R Htmlwidget to Export Other Htmlwidgets and SVG As PNG

exportwidget - htmlwidget to export htmlwidgets

This is pre-alpha and experimental v0.2.0 but should work. Note, this currently does not work in RStudio Viewer. export_widget was the widget of the week at Building Widgets, so you can see it in action in this blog post.

Thanks so much to the following libraries and their authors.

  1. fabric.js
  2. Download-File-JS

Install

devtools::install_github("timelyportfolio/exportwidget")

Example with an htmlwidget | DiagrammeR

library(pipeR)
library(htmltools)
library(DiagrammeR)
library(exportwidget)

tagList(
  grViz(" digraph { a->b; b->c; c->a; }")
  ,export_widget( )
) %>>% html_print( viewer = utils::browseURL ) #export not working in RStudio Viewer

Example with multiple htmlwidgets

library(pipeR)
library(htmltools)
library(DiagrammeR)
library(rcdimple)
library(networkD3)
library(exportwidget)

tagList(
  grViz(" digraph { a->b; b->c; c->a; }")
  ,dimple(
    mtcars
    , mpg ~ cyl
    , groups = "cyl"
    , type = "bubble"
  )
  ,simpleNetwork(
    data.frame(
      Source = c("A", "A", "A", "A", "B", "B", "C", "C", "D")
      ,Target = c("B", "C", "D", "J", "E", "F", "G", "H", "I")
    )
    ,height = 400
    ,width = 400
  )
  ,export_widget( )
) %>>% html_print( viewer = utils::browseURL ) #export not working in RStudio Viewer
library(streamgraph)
library(dplyr)
library(exportwidget)
library(webshot)
library(ggplot2movies)

movies %>%
    select(year, Action, Animation, Comedy, Drama, Documentary, Romance, Short) %>%
    tidyr::gather(genre, value, -year) %>%
    group_by(year, genre) %>%
    tally(wt=value) %>%
    ungroup %>%
    mutate(year=as.Date(sprintf("%d-01-01", year))) -> dat

html_print(tagList(
  streamgraph(dat, "genre", "n", "year")
  ,export_widget( )
)) %>%
  normalizePath(.,winslash="/") %>%
  gsub(x=.,pattern = ":/",replacement="://") %>%
  paste0("file:///",.) %>%
  webshot( file = "stream_screen.png", delay = 10 )

Download Details:

Author: Timelyportfolio
Source Code: https://github.com/timelyportfolio/exportwidget 
License: MIT license

#r #widget #svg #png 

Nat  Grady

Nat Grady

1666376400

Shanban: Jkanban Htmlwidget

shanban

WORK IN PROGRESS

htmlwidgets for jkanban

Installation

You can install the development version of {shanban} like so:

remotes::install_github("thinkr-open/shanban")

Example

This is a basic example which shows you how to solve a common problem:

library(shanban)
kanban(
  boards = list(
    Board$new(
      id = "one",
      title = "First board",
      dragTo = "two"
    )$add_item(
      id = "one",
      title = "First item"
    )$add_item(
      id = "two",
      title = "Second item"
    )$serve(),
    Board$new(
      id = "two",
      title = "Second board",
      dragTo = "one"
    )$add_item(
      id = "one",
      title = "First item"
    )$add_item(
      id = "two",
      title = "Second item"
    )$serve()
  )
)
one_board <- function(
  id,
  dragTo = NULL
) {
  Board$new(
    id = id,
    title = sprintf("Board %s", id),
    dragTo = dragTo
  )$add_item(
    id = "one",
    title = "Do this"
  )$add_item(
    id = "two",
    title = "And also this"
  )$serve()
}
library(shanban)
options(shiny.port = httpuv::randomPort())
library(shiny)
ui <- function(request) {
  fluidPage(
    column(
      12,
      fluidRow(
        kanbanOutput("x")
      ),
      fluidRow(
        column(
          4,
          actionButton("rm", "Remove board two"),
          actionButton("add", "Add board two")
        ),
        column(
          4,
          textInput("id", "id of item to add"),
          textInput("title", "Content of item to add"),
          actionButton("additem", "Add the item to board one")
        ),
        column(
          4,
          verbatimTextOutput("content")
        )
      )
    )
  )
}

server <- function(
  input,
  output,
  session
) {
  observeEvent(
    input$rm,
    {
      removeBoard(
        "x",
        "two"
      )
    }
  )

  observeEvent(
    input$add,
    {
      addBoard(
        "x",
        one_board(
          "two",
          dragTo = "one"
        )
      )
    }
  )

  observeEvent(input$additem, {
    addElement(
      "x",
      boardId = "one",
      id = input$id,
      title = input$title
    )
  })

  output$x <- renderKanban({
    kanban(
      boards = list(
        # First board
        one_board(
          id = "one",
          dragTo = "two"
        ),
        # Second board
        one_board(
          "two",
          dragTo = "one"
        )
      )
    )
  })

  output$content <- renderPrint({
    parse_input(input$x_content)
  })

  observeEvent(input$x_content, {
    cli::cat_rule("input$x_content")
    print(parse_input(input$x_content))
  })
  observeEvent(input$x_last_item_clicked, {
    cli::cat_rule("input$x_last_item_clicked")
    print(input$x_last_item_clicked)
  })
  observeEvent(input$x_last_item_contexted, {
    cli::cat_rule("input$x_last_item_contexted")
    print(input$x_last_item_contexted)
  })
  observeEvent(input$x_last_item_dragged, {
    cli::cat_rule("input$x_last_item_dragged")
    print(input$x_last_item_dragged)
  })
}

shinyApp(ui, server)

Download Details:

Author: ThinkR-open
Source Code: https://github.com/ThinkR-open/shanban 
License: View license

#r #html #widget 

Nat  Grady

Nat Grady

1666231345

Trianglify: Htmlwidget for Trianglify

trianglify

htmlwidget for trianglify.

Installation

# install.packages("devtools")
devtools::install_github("JohnCoene/trianglify")

Example

See the website for more.

library(trianglify)

trianglify()

Download Details:

Author: JohnCoene
Source Code: https://github.com/JohnCoene/trianglify 
License: Unknown, MIT licenses found

#r #rstats #html #widget 

Nat  Grady

Nat Grady

1664270400

Isotope: Isotope Htmlwidget for R

Isotope Htmlwidget for R

Isotope layout library straight from R to render Data Frames as interactive galleries. It handles sortings, filtering and custom item html templates. Uses basscss.

How to

If you provide filterCols you can select which columns to use as filters.

If you provide sortCols you can select which columns to use to sort the items.

You can also provide custom html templates to render the items.

# devtools::install_github("jpmarindiaz/isotope")
library(isotope)
d <- read.csv(system.file("data/candidatos.csv",package="isotope"), stringsAsFactors = FALSE)

filterCols <- c("genero","profesiones", "niveldeestudios","talante", "pragmaticoideologico","visionpais")
sortCols <- c("nombre","apoyosenadores","apoyorepresentantes")

tpl <- '
<div style="border: 1px solid grey; margin:5px; padding:5px">
  <div class="container">
    <h3 class="nombre">{{nombre}}</h3>
    <div style="width:125px; height: 125px; margin:auto">
      <img src={{foto}} class="circle" width="100px"/>
    </div>
    <p>Profesión: {{profesiones}}, Género: {{genero}},Nivel de estudios: {{niveldeestudios}}</p>
    <div class="apoyosenadores"><em>Apoyo Senadores:</em> {{apoyosenadores}}</div>
    <div class="apoyorepresentantes"><em>Apoyo Representantes:</em> {{apoyorepresentantes}}</div>
  </div>
</div>
'
isotope(d, filterCols = filterCols, sortCols = sortCols, lang = 'es', elemTpl = tpl)

Todo

  • Sort opts: Button names, original-order(add/remove, lang)
  • style sort buttons
  • Add width/height properties for elements
  • add custom css
  • Fix some layoutModes by adding height property to each item
  • Warn about sort buttons not present in template
  • Add more separators for multiple values per column currently only "," is supported.

Download Details:

Author: jpmarindiaz
Source Code: https://github.com/jpmarindiaz/isotope 

#r #html #widget