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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.