일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- openCV
- Machine Learning
- Statistics
- probability
- 주일설교
- c++
- 몽고디비
- 빅데이터
- 빅데이타
- 빅 데이타
- 김양재 목사님
- Big Data
- R
- WebGL
- 김양재
- 인공지능
- No SQL
- MongoDB
- 빅 데이터
- 딥러닝
- 우리들교회
- 통계
- 데이터 과학
- Artificial Intelligence
- Deep learning
- node.js
- 확률
- data science
- 김양재 목사
- nodeJS
- Today
- Total
Scientific Computing & Data Science
[Data Mining with R] Shiny Apps / Plot Output 본문
[Data Mining with R] Shiny Apps / Plot Output
cinema4dr12 2014. 10. 26. 21:46[ui.R]
library(shiny); shinyUI(fluidPage( titlePanel("Plot Output Example - by cinema4dr12"), sidebarLayout( sidebarPanel( selectInput("var1", label = "Choose first variable", choices = c("mpg", "cyl", "disp", "hp", "drat", "wt", "qsec", "vs", "am", "gear", "carb"), selected = "mpg" ), selectInput("var2", label = "Choose second variable", choices = c("mpg", "cyl", "disp", "hp", "drat", "wt", "qsec", "vs", "am", "gear", "carb"), selected = "mpg" ) ), mainPanel( plotOutput("myPlot") ) ) ))
[server.R]
library(shiny); shinyServer( function(input, output){ output$myPlot = renderPlot({ x = input$var1; y = input$var2; switch(x, "mpg" = { dataX = mtcars$mpg; xlabel = "mpg"; }, "cyl" = { dataX = mtcars$cyl; xlabel = "cyl"; }, "disp" = { dataX = mtcars$disp; xlabel = "disp"; }, "hp" = { dataX = mtcars$hp; xlabel = "hp"; }, "drat" = { dataX = mtcars$drat; xlabel = "drat"; }, "wt" = { dataX = mtcars$wt; xlabel = "wt"; }, "qsec" = { dataX = mtcars$qsec; xlabel = "qsec"; }, "vs" = { dataX = mtcars$vs; xlabel = "vs"; }, "am" = { dataX = mtcars$am; xlabel = "am"; }, "gear" = { dataX = mtcars$gear; xlabel = "gear"; }, "carb" = { dataX = mtcars$carb; xlabel = "carb"; } ); switch(y, "mpg" = { dataY = mtcars$mpg; ylabel = "mpg"; }, "cyl" = { dataY = mtcars$cyl; ylabel = "cyl"; }, "disp" = { dataY = mtcars$disp; ylabel = "disp"; }, "hp" = { dataY = mtcars$hp; ylabel = "hp"; }, "drat" = { dataY = mtcars$drat; ylabel = "drat"; }, "wt" = { dataY = mtcars$wt; ylabel = "wt"; }, "qsec" = { dataY = mtcars$qsec; ylabel = "qsec"; }, "vs" = { dataY = mtcars$vs; ylabel = "vs"; }, "am" = { dataY = mtcars$am; ylabel = "am"; }, "gear" = { dataY = mtcars$gear; ylabel = "gear"; }, "carb" = { dataY = mtcars$carb; ylabel = "carb"; } ); main = paste("Plot between", xlabel); main = paste(main, " & "); main = paste(main, ylabel); plot(dataX, dataY, main = main, xlab = xlabel, ylab = ylabel); }) } )
[Results]
'Data Science > Data Mining with R Programming' 카테고리의 다른 글
[Data Mining with R] ShinyApps / Reactive Output에 대하여 (0) | 2014.11.02 |
---|---|
[Data Mining with R] R / R에서 한글입력 시 깨짐 현상 해결 팁 (2) | 2014.11.01 |
[Data Mining with R] Shiny Apps / Text Output (0) | 2014.10.26 |
[Data Mining with R] ShinyApps Test (0) | 2014.10.18 |
[Data Mining with R Programming] 동문회 기부금액 분석 (0) | 2014.05.27 |