방문하기
Shiny를 사용하여 R로 웹 애플리케이션 만들기
Shiny를 사용하여 R로 웹 애플리케이션을 만드는 단계는 다음과 같다.
1) Shiny 패키지 설치: R에서 Shiny 패키지를 설치한 후 메모리로 불러들인다..
install.packages('shiny')
library(shiny)
2) UI 구성: Shiny 앱의 사용자 인터페이스를 만든다. 이는 R 코드에서 HTML과 CSS를 사용하여 구성된다.
3) Server 구성: Shiny 앱의 서버를 만든다. 이는 R 코드로 구성된다.
4) 앱 실행: Shiny 앱을 실행한다. 이를 위해 runApp() 함수를 사용한다.
5) 배포: shinyapps.io와 같은 서비스를 사용하여 Shiny 앱을 인터넷에 배포한다.
Shiny 어플리케이션 구조
ui server shinyApp(ui, server) |
예 1
ui = fluidPage(textOutput('txt')) server = function(input, output, session){ output$txt = renderText('Hello World') } shinyApp(ui, server) |
예 2
ui = fluidPage(sliderInput("obs", "Number of observations:", min = 1, max = 1000, value = 500), plotOutput("distPlot")) server = function(input, output, session){ output$distPlot = renderPlot( { hist(rnorm(input$obs)) } ) } shinyApp(ui, server) |
예 3
ui = fluidPage( sliderInput("obs", "Number of observations:", min = 1, max = 50, value = 5), plotOutput("distPlot")) server = function(input, output){ output$distPlot = renderPlot( { with(cars, { plot(speed, dist) lines(ksmooth(speed[1:input$obs], dist, "normal", bandwidth = 2), col = 2) lines(ksmooth(speed[1:input$obs], dist, "normal", bandwidth = 5), col = 3) }) }) } shinyApp(ui, server) |
2022 서울시 빅데이터 활용 분석 사례 우수사례 경진대회(2시간 57분) : https://www.youtube.com/watch?v=Edies0EK7PU
자동화 업무를 R언어로 할 수 있을까요? 모든 업무를 자동으로!!(8분) : https://www.youtube.com/watch?v=0-NEskhEAwo
머신러닝 모델 학습과 R샤이니를 통한 웹 배포(35분) : https://www.youtube.com/watch?v=RyPl6QSJAXM
나만의 대쉬보드 만들기(15분) : https://www.youtube.com/watch?v=8QSkrfE7j_Y
R 웹에 게시하기(31분) : https://www.youtube.com/watch?v=kekDX1Y7S04
R Shiny를 활용한 서울시 사망 교통사고 분석 파일 : https://www.youtube.com/watch?v=u9aKK32q0uo
무작정 따라하기 R shiny 1(31분) : https://www.youtube.com/watch?v=tGg935D8mbk
'언어 > R' 카테고리의 다른 글
빅데이터 자격증 (0) | 2023.06.06 |
---|---|
통계량, boxplot, t검정 (0) | 2023.05.22 |
[R-012] R - markdown (0) | 2023.05.14 |
[R-011] ggplot2 - geom_bar() (0) | 2023.05.05 |
[R-010] ggplot2 - geom_point() (0) | 2023.05.03 |
댓글