Description Usage Arguments Details See Also Examples
Creates module's UI for tabset panel containing two tabs - with plot and an elegant table with data.
1 2 3 4 5 6 | beam_plot_panel_UI(
id,
tab_plot = paste(id, "plot"),
tab_table = paste(id, "data"),
helpfiles = "helpfiles"
)
|
id |
unique ID name of tabset. The same ID as in the corresponding server for a module |
tab_plot |
Character. Title of tab containing plot. Default to
|
tab_table |
Character. Title of tab containing table. Default to
|
helpfiles |
A character string denoting directory to save empty help files.
Default |
Module's UI involves a panel with two tabs. The first tab consists of
displayed plot and three download buttons (png, svg and jpeg). There is also a
compatible with the plot tooltip. The second tab consists of a table
with two download buttons (Excel and CSV). For both table and plot there are
provided helpers. \
For more information see plotOutput_h
and
tableOutput_h
To build Shiny module within a Shiny app using beam_plot_panel_UI
see beam_plot_panel_SERVER
.
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | ## Not run:
ui <- fluidPage(title = "Example app",
beam_plot_panel_UI("airquality_basic"),
beam_plot_panel_UI("airquality_advanced",
tab_plot = "An advanced plot",
tab_table = "An elegant table for an advanced plot",
helpfiles = "custom_helpfiles"))
server <- function(input, output, session) {
airquality_basic_plot <- reactive({
ggplot(airquality, aes(x = Wind, y = Temp, col = as.character(Month))) +
geom_point()
})
airquality_basic_data <- reactive({
airquality
})
beam_plot_panel_SERVER("airquality_basic",
plot_out = airquality_basic_plot(),
table_out = airquality_basic_data())
airquality_advanced_data <- reactive({
df <- data.frame(aggregate(. ~ Month, airquality, function(x) c(mean = mean(x), sd = sd(x)))[, c(1, 5)])
df[["Month"]] <- month.name[df[["Month"]]]
data.frame(Month = df[["Month"]],
Temp_mean = df$Temp[, 1],
Error = df$Temp[, 2],
Year = 1973)})
airquality_advanced_plot <- reactive({
ggplot(airquality_advanced_data(), aes(y = 0, yend = Temp_mean, x = Month, xend = Month)) +
geom_segment() +
geom_point(mapping = aes(x = Month, y = Temp_mean), size = 3) +
geom_point() +
ylab("average temperature")
})
beam_plot_panel_SERVER("airquality_advanced",
plot_out = airquality_advanced_plot(),
table_out = airquality_advanced_data(),
plot_type = "geom_segment",
tt_content = list(row_text = c("Date: %s %i",
"Average temperature: %f °F",
"Error: %f",
"Place: La Guardia Airport"),
chosen_cols = c("Month",
"Year",
"Temp_mean",
"Error"))
)
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.