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
About the Authors
About the Reviewer

Using ggplot2

In the next few pages, you will see how to apply the principles of the The Grammar of Graphics with the ggplot2 package. With this package, you are able to change a lot of details in your graphics and create your own individual style. We will give you examples of some of its main settings.

Installing the ggplot2 package

You can find the ggplot2 package on CRAN, which makes it very easy to install it:


You are then able to simply load it with the following:


Or, you can just check the box in front of the package name in the packages pane of RStudio:

Qplot() and ggplot()

The ggplot2 package provides two functions to create graphic objects:



qplot stands just for quick plot, and ggplot is an abbreviation of grammar of graphics plot, which shows its strong connection to the framework mentioned earlier.

qplot aims to be very similar to the basic plot function, and to be very simple to use. But it does not follow the full capacity...