add: Add & Clear

Description Usage Arguments Examples

Description

Add and clear data in Shiny.

Usage

1
2
3
g_clear_p(proxy)

g_data_p(proxy, data, from, to, value, ...)

Arguments

proxy

A proxy as returned by giorProxy.

data

A data.frame.

from

Source and target of edges.

to

Source and target of edges.

value

Numerical value of edges.

...

Any other columns to select from the data, i.e.: inColor or outColor

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
if(interactive()){

  library(shiny)

  data("country_data")

  ui <- fluidPage(
    actionButton("add", "add"),
    actionButton("clear", "clear"),
    giorOutput("gior")
  )

  server <- function(input, output, session){
    output$gior <- renderGior({
      data %>%
        gior() %>%
        g_data(from, to, value)
    })

    observeEvent(input$clear, {
      giorProxy("gior") %>%
        g_clear_p()
    })

    observeEvent(input$add, {
      giorProxy("gior") %>%
        g_data_p(country_data, from, to, value)
    })
  }

  shinyApp(ui, server)

}

JohnCoene/gior documentation built on March 6, 2020, 1:07 a.m.