O'Reilly logo

Practical Predictive Analytics by Ralph Winters

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

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 ...

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