Skip to Content
R: Data Analysis and Visualization
book

R: Data Analysis and Visualization

by Tony Fischetti, Brett Lantz, Jaynal Abedin, Hrishi V. Mittal, Bater Makhabel, Edina Berlinger, Ferenc Illés, Milán Badics, Ádám Banai, Gergely Daróczi, Barbara Dömötör, Gergely Gabler, Dániel Havran, Péter Juhász, István Margitai, Balázs Márkus, Péter Medvegyev, Julia Molnár, Balázs Árpád Szucs, Ágnes Tuza, Tamás Vadász, Kata Váradi, Ágnes Vidovics-Dancs
June 2016
Beginner to intermediate content levelBeginner to intermediate
1783 pages
71h 22m
English
Packt Publishing
Content preview from R: Data Analysis and Visualization

Creating line graphs

Line graphs are generally used to look at trends in data over time, so the x variable is usually time expressed as time of day, date, month, year, and so on. In this recipe, we will see how we can quickly plot such data using the same plot() function that was used in the previous recipe to make scatter plots.

Getting ready

First, we need to load the dailysales.csv example data file (you can download this file from the code download section of the book's companion website):

sales<-read.csv("dailysales.csv", header=TRUE)

As the file's name suggests, it contains daily sales data of a product. It has two columns: a date column and a sales column that shows the number of units sold.

How to do it...

Here's the code to make your first ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Exploratory Data Analysis with R

Hands-On Exploratory Data Analysis with R

Radhika Datar, Harish Garg

Publisher Resources

ISBN: 9781786463500Supplemental Content