Building Interactive Visualizations with Shiny
摘要
This chapter describes the functionalities and applications of the Shiny package, a framework within the R programming language designed to simplify the creation of interactive web applications. Shiny enables R users, typically focused on statistical problems, to create web applications without the need to learn additional programming languages like HTML, CSS, or JavaScript. Users can select pre-built interfaces and adapt them to their needs, facilitating the creation of personalized reports, interactive visualizations for educational purposes, simulations, and simplified data analysis interfaces. Key features of Shiny include reactive programming, user interface components, server-side processing, web design templates, and software deployment capabilities. These features enable real-time reactions to data changes, easy customization of interfaces, efficient server-side processing of R code, and deployment of applications on the web for global accessibility. The document also provides a practical guide for using Shiny, including installation instructions and an overview of the structure of Shiny applications, which consist of a user interface and a server component. It describes how to create a Shiny app from scratch, demonstrating the process with an example app for visualizing economic data from the World Bank. The example illustrates defining the app’s user interface, selecting data, and generating dynamic plots based on user input. Finally, the document discusses options for hosting Shiny apps, including self-hosting on cloud services or using free hosting services.