# How to Create Pareto Chart in R

Pareto Chart in R, Pareto chart is a combination of a line graph and a bar chart used for visualization.

A Pareto graph is a type of chart that displays the frequencies of the different categories with the cumulated frequencies of the categories.

## How to create a Pareto chart in R

This tutorial describes how to create a Pareto chart in R.

### Step 1: Create the Data for Pareto Chart

Let’s create a data frame with the product and its count.

The following dataset shows the total counts for each product,

Extract text from pdf in R and word Detection »

# data frame

df <- data.frame(product=c('A', 'B', 'C', 'D', 'E', 'F'), count=c(40, 57, 50, 82, 17, 16))

#view data

df

product count 1 A 40 2 B 57 3 C 50 4 D 82 5 E 17 6 F 16

### Step 2: Create the Pareto Chart

For the Pareto chart creation, we can make use of the pareto.chart() function from the qcc package, Let’s load the library first.

Funnel Chart in R-Interactive Funnel Plot »

library(qcc)

#create Pareto chart

pareto.chart(df$count)

Pareto chart analysis for df$count

Frequency Cum.Freq. Percentage Cum.Percent. D 82.00000 82.00000 31.29771 31.29771 B 57.00000 139.00000 21.75573 53.05344 C 50.00000 189.00000 19.08397 72.13740 A 40.00000 229.00000 15.26718 87.40458 E 17.00000 246.00000 6.48855 93.89313 F 16.00000 262.00000 6.10687 100.00000

The above table output displays the frequency and cumulative frequency of each product.

In more detail

Frequency of product D: 82 | Cumulative frequency: 82

Frequency of brand B: 57 | Cumulative frequency of A, D: 139

And so on.

Transition plot in R-change in time visualization »

### Step 3: Modify the Pareto Chart

We can make aesthetic changes in the Pareto chart.

pareto.chart(df$count, main='Pareto Chart', col=heat.colors(length(df$count)))