O'Reilly logo

Practical Business Intelligence by Ahmed Sherif

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating graphs in R

Once a dataframe has been set up with the necessary column, we can begin to graph the data and explore visualization options.

Creating simple charts with plot() in R

The most basic graph can be generated with the plot() function using the following script:

plot(SQL_Query_1, main = 'Discount Code by Week') 

The output of the script can be seen here:

Creating simple charts with plot() in R

While the plot displays the discount by week, it is difficult to identify the relationship week-to-week without being able to connect the dots.

The following script will connect the dots between each sequential point:

plot(SQL_Query_1, main = 'Discount Code by Week', type="o") 

The output ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required