Analyzing the invoice dates

We can also look at the distribution plots of InvoiceDate. But first, the date will need to be transformed to date format (Capture.output shows it as a string) and sorted first:

 InvoiceDate <- gsub(" .*$", "", OnlineRetail$InvoiceDate) InvoiceDate <- (as.Date(InvoiceDate, format = "%m/%d/%Y")) InvoiceDate <- sort(InvoiceDate, decreasing = FALSE) 

First, observe from the output of the str() function that InvoiceDate is now truly in date format:

> str(InvoiceDate)

This is the following output:

Date[1:541909], format: "2010-12-01" "2010-12-01" "2010-12-01" "2010-12-01" "2010-12-01" "2010-12-01" "2010-12-01" "201... <truncated>

We can see from the head and tail commands, as well as the plots, that the invoices ...

Get Practical Predictive Analytics now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.