Agenda
Overview
UI Functions
Question & Answer
Agenda
Overview
UI Functions
Question & Answer
Data scientists forget functions when writing Shiny UIs
from shiny import App, render, ui
app_ui = ui.page_fluid(
ui.input_slider("n1", "N", 0, 100, 20),
ui.input_slider("n2", "N", 0, 100, 20),
ui.input_slider("n3", "N", 0, 100, 20),
ui.input_slider("n4", "N", 0, 100, 20),
ui.input_slider("n5", "N", 0, 100, 20),
ui.input_slider("n6", "N", 0, 100, 20),
)
app = App(app_ui, None)
from shiny import App, render, ui
def my_slider(id, label):
return ui.input_slider(id, label + "Number", 0, 100, 20)
numbers = ["n1", "n2", "n3", "n4", "n5", "n6"]
labels = ["First", "Second", "Third", "Fourth", "Fifth", "Sixth"]
app_ui = ui.page_fluid(
[my_slider(x, y) for x, y in zip(numbers, labels)]
)
app = App(app_ui, None)
Go to exercises/13-ui-functions or run problems 5.1
and 5.2
in apps/problem-sets/exercises/5-workflows
.
Go to exercises/14-extract-functions or run problem 5.3
in apps/problem-sets/exercises/5-workflows
.
Agenda
Overview
UI Functions
Question & Answer
Also, please fill out the survey:
https://pos.it/conf-workshop-survey