// Remove fullscreen button from SageCell.

An R TUTORIAL for Statistics Applications

Part 1 - Section 1: Modifying Data

This chapter covers basic information regarding data visualisation using R.

Email Vladimir Dobrushkin

The first step in trying to interpret data is often to visualize it in some way. Data visualization can be as simple as creating a summary table, or it could require generating charts to help interpret, analyze, and learn from the data. Data visualization is very helpful for identifying data errors and reducing the size of your data set by highlighting important relationships and trends.

a. The Comprehensive R Archive Network (CRAN), or R for short, has a well-established plotting engine. Creating plots in R is simple, powerful, and effective, for a wide variety of applications. One of the main reasons that data analysts and data scientists turn to R is for its strong graphic capabilities. The extensive online documentation allows for quick troubleshooting, and a massive library of packages allows R to be extended to nearly an application.

Effective Design Techniques

We can store the data in R as two separate vectors via the following command:

Once you execute the code, there is no output. This is because you did not ask to display the input. One can eitehr use View command or plot.

Given X and Y from previous exercises, we can plot X vs. Y.

Within this plot, we have a nice range of customizability, from point types, to adding titles and changing the X and Y axis titles, to adding data labels, etc. To add a title, we call the command:

A handy trick to get some a smoothed line to best display this information:

In order to call a line graph, we will simply access the graphical parameters within our plot() command. The parameter “type” will allow us to switch from scatter to line, or line with points.

We can also add data labels by calling an additional line, using the text() command:

The “pos = ” addition allows us to set where we want said data labels to show up. For more graphical parameters, follow this link and explore:

https://www.statmethods.net/advgraphs/parameters.html

The Order Function