i

R Programming Complete Tutorial

R – Charts and Graphs

Graphs are the best tools for Data Visualization. It is always a good idea to present the outcomes through graphs. R uses a good variety of graphs. We are going to talk about some:

Histogram:

A Histogram represents the frequencies of valves of a variable bucketed into ranges. Each bar in the Histogram represents the height of the number of valves present in the range.

We create a Histogram using hist() function. This hist() function takes a vector as an input and uses some more optional parameters to plot Histograms; this break is used to mention the width of each bar.

Syntax of hist() Function:

Example:

In our example, we have created a histogram using the mpg column of mtcars data set, setting the breaks as 5.

Graph Output: