Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace dataset calls in vignettes with box imports #124

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 12 additions & 4 deletions vignettes/rhino.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Modify `app/main.R` in the following way:
box::use(
shiny,
graphics[hist],
datasets[faithful],
)

#' @export
Expand Down Expand Up @@ -103,7 +104,8 @@ ui <- function(id) {
server <- function(id) {
shiny$moduleServer(id, function(input, output, session) {
output$distPlot <- shiny$renderPlot({
x <- datasets::faithful[, 2]
# Note : If you are using `box>=1.1.3`, import datasets directly without using `datasets::faithful`
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(
x,
Expand Down Expand Up @@ -287,6 +289,7 @@ box::use(
shiny,
graphics[hist],
shiny.i18n[Translator, usei18n, update_lang],
datasets[faithful],
)

i18n <- Translator$new(translation_json_path = "app/translations/translations.json")
Expand Down Expand Up @@ -333,7 +336,8 @@ server <- function(id) {
})

output$distPlot <- shiny$renderPlot({
x <- datasets::faithful[, 2]
# Note : If you are using `box>=1.1.3`, import datasets directly without using `datasets::faithful`
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(
x,
Expand Down Expand Up @@ -418,6 +422,7 @@ box::use(
shiny,
graphics[hist],
shiny.i18n[Translator, usei18n, update_lang],
datasets[faithful],
)

i18n <- Translator$new(translation_json_path = "app/translations/translations.json")
Expand Down Expand Up @@ -464,7 +469,8 @@ server <- function(id) {
})

output$distPlot <- shiny$renderPlot({
x <- datasets::faithful[, 2]
# Note : If you are using `box>=1.1.3`, import datasets directly without using `datasets::faithful`
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(
x,
Expand Down Expand Up @@ -522,6 +528,7 @@ Now, let's move the main panel from `app/main.R` into `app/view/main_panel.R`:
box::use(
shiny,
graphics[hist],
datasets[faithful],
)

#' @export
Expand All @@ -538,7 +545,8 @@ ui <- function(id, i18n) {
server <- function(id, bins, i18n) {
shiny$moduleServer(id, function(input, output, session) {
output$distPlot <- shiny$renderPlot({
x <- datasets::faithful[, 2]
# Note : If you are using `box>=1.1.3`, import datasets directly without using `datasets::faithful`
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = bins() + 1)
hist(
x,
Expand Down