Shinyでヒストグラムを表示
library(shiny)
library(ggplot2)
rm(list=ls())
# データを定義
data("iris")
x <- iris
head(x)
# ユーザインタフェースを定義
ui <- fluidPage(
h1("Iris Histogram"),
selectInput(inputId = "colname", label = "列名", choices = colnames(x)[-ncol(x)]),
plotOutput(outputId = "histogram")
)
# サーバの処理(ヒストグラムの作成)を定義
server <- function(input, output, session){
output$histogram <- renderPlot({
ggplot(data = x, mapping = aes(x = x[, input$colname])) + geom_histogram() + xlab(input$colname)
})
}
# アプリを起動
shinyApp(ui = ui, server = server)
Author And Source
この問題について(Shinyでヒストグラムを表示), 我々は、より多くの情報をここで見つけました https://qiita.com/yono2844/items/7c0d3dc29ee48dcbf097著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .