-
Notifications
You must be signed in to change notification settings - Fork 58
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
docs(pkgdown): Re-organize and add descriptions to reference index #842
Conversation
Also prefer `rlang::is_interactive()`
Co-authored-by: Carson Sievert <[email protected]>
#' library(shiny) | ||
#' library(ggplot2) | ||
#' | ||
#' ui <- page_fillable( | ||
#' h1("Example", code("mtcars"), "dashboard"), | ||
#' layout_columns( | ||
#' card( | ||
#' full_screen = TRUE, | ||
#' card_header("Number of forward gears"), | ||
#' plotOutput("gear") | ||
#' ), | ||
#' card( | ||
#' full_screen = TRUE, | ||
#' card_header("Number of carburetors"), | ||
#' plotOutput("carb") | ||
#' ) | ||
#' ), | ||
#' card( | ||
#' full_screen = TRUE, | ||
#' card_header("Weight vs. Quarter Mile Time"), | ||
#' layout_sidebar( | ||
#' sidebar = sidebar( | ||
#' varSelectInput("var_x", "Compare to qsec:", mtcars[-7], "wt"), | ||
#' varSelectInput("color", "Color by:", mtcars[-7], "cyl"), | ||
#' position = "right" | ||
#' ), | ||
#' plotOutput("var_vs_qsec") | ||
#' ) | ||
#' ) | ||
#' ) | ||
#' | ||
#' server <- function(input, output) { | ||
#' for (var in c("cyl", "vs", "am", "gear", "carb")) { | ||
#' mtcars[[var]] <- as.factor(mtcars[[var]]) | ||
#' } | ||
#' | ||
#' output$gear <- renderPlot({ | ||
#' ggplot(mtcars, aes(gear)) + geom_bar() | ||
#' }) | ||
#' | ||
#' output$carb <- renderPlot({ | ||
#' ggplot(mtcars, aes(carb)) + geom_bar() | ||
#' }) | ||
#' | ||
#' output$var_vs_qsec <- renderPlot({ | ||
#' req(input$var_x, input$color) | ||
#' | ||
#' ggplot(mtcars) + | ||
#' aes(y = qsec, x = !!input$var_x, color = !!input$color) + | ||
#' geom_point() | ||
#' }) | ||
#' } | ||
#' | ||
#' shinyApp(ui, server) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Maybe once shiny::runExample()
gets an extension point this would be a good candidate for an example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks and yeah, good idea!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done, thanks! Feel free to merge once the last few comments are addressed
Co-authored-by: Carson Sievert <[email protected]>
Closes #808
page_navbar()
andpage_fillable()
now have their own reference pages, separate frompage()
.@examplesIf rlang::is_interactive()
.Preview (screenshot)