사례 연구: R의 Shiny로 웹 애플리케이션 만들기
Dean Attali
Shiny Consultant
새 데이터셋 탐색의 첫 단계로 플롯이 흔합니다
plotOutput("my_plot")
output$my_plot <- renderPlot({
# code for a plot
})
다운로드는 다운로드 버튼으로 지원됩니다

Comma Separated Values(쉼표로 구분된 값)
소·중규모 데이터셋 저장에 적합
gapminder의 CSV 예:
country,continent,year,lifeExp,pop,gdpPercap
Afghanistan,Asia,1952,28.801,8425333,779.4453145
Afghanistan,Asia,1957,30.332,9240934,820.8530296
Afghanistan,Asia,1962,31.997,10267083,853.10071
Afghanistan,Asia,1967,34.02,11537966,836.1971382
CSV 파일 생성:
write.csv(gapminder, "myfile.csv")
다운로드 버튼은 출력으로 취급됩니다
downloadButton(outputId = "download_data",
label = "Download data")
output$download_data <- downloadHandler(
filename = "data.csv",
content = function(file) {
# Code that creates a file in the path <file>
write.csv(gapminder, file)
}
)
output$download_data <- downloadHandler(
filename = "data.csv",
content = function(file) {
# code that creates a file in the path <file>
write.csv(gapminder, file)
}
)
downloadHandler()의 두 인자filenamecontent(file)사례 연구: R의 Shiny로 웹 애플리케이션 만들기