Book Image

Mastering RStudio: Develop, Communicate, and Collaborate with R

4 (1)
Book Image

Mastering RStudio: Develop, Communicate, and Collaborate with R

4 (1)

Overview of this book

RStudio helps you to manage small to large projects by giving you a multi-functional integrated development environment, combined with the power and flexibility of the R programming language, which is becoming the bridge language of data science for developers and analyst worldwide. Mastering the use of RStudio will help you to solve real-world data problems. This book begins by guiding you through the installation of RStudio and explaining the user interface step by step. From there, the next logical step is to use this knowledge to improve your data analysis workflow. We will do this by building up our toolbox to create interactive reports and graphs or even web applications with Shiny. To collaborate with others, we will explore how to use Git and GitHub and how to build your own packages to ensure top quality results. Finally, we put it all together in an interactive dashboard written with R.
Table of Contents (17 chapters)
Mastering RStudio – Develop, Communicate, and Collaborate with R
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

The concept of reactivity


Shiny uses a reactive programming model, and this is a big deal. By applying reactive programming, the framework is able to be fast, efficient, and robust. Briefly, changing the input in the user interface, Shiny rebuilds the related output. Shiny uses three reactive objects:

  • Reactive source

  • Reactive conductor

  • Reactive endpoint

For simplicity, we use the formal signs of the RStudio documentation:

The implementation of a reactive source is the reactive value; that of a reactive conductor is a reactive expression; and the reactive endpoint is also called the observer.

The source and endpoint structure

As taught in the previous section, the defined input of the ui.R links is the output of the server.R file. For simplicity, we use the code from our first Shiny app again, along with the introduced formal signs:

...
        output$carsPlot <- renderPlot({

                hist(mtcars[,input$variable], 
                     main = "Histogram of mtcars variables",
         ...