library(flexdashboard)
library(ggplot2)
data(wine_data, package = "WineReviews")

Inputs {.sidebar data-width=150}

shiny::selectInput(
 "country",
 label = "select country",
 choices = sort(unique(wine_data$country))
)

Column

Wine points versus price

shiny::renderPlot(
 ggplot(wine_data[wine_data$country == input$country, ],
 aes(points, log10(price), group = points)) +
 geom_boxplot() +
 labs(x = "points scored by the wine on a 100 scale",
 y = "Base-10 logarithm of the wine price") +
 theme_bw()
)

Column

Wine price distribution

shiny::renderPlot(
 ggplot(wine_data[wine_data$country == input$country, ], aes(price)) +
 geom_density() +
 labs(y = "Price density function") +
 theme_bw()
)


gontcharovd/WineReviews documentation built on Feb. 29, 2020, 12:42 a.m.