กรณีศึกษา: การสร้างเว็บแอปพลิเคชันด้วย Shiny ใน R
Dean Attali
Shiny Consultant
พล็อตเป็นขั้นตอนแรกที่นิยมใช้เมื่อสำรวจชุดข้อมูลใหม่
plotOutput("my_plot")
output$my_plot <- renderPlot({
# code for a plot
})
รองรับการดาวน์โหลดผ่านปุ่มดาวน์โหลด

Comma Separated Values
เก็บชุดข้อมูลขนาดเล็กถึงกลาง
CSV ของ gapminder:
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")
ปุ่มดาวน์โหลดถูกจัดการเป็น output
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() มี 2 อาร์กิวเมนต์filenamecontent(file)กรณีศึกษา: การสร้างเว็บแอปพลิเคชันด้วย Shiny ใน R