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

capture.output function

This code also illustrates the capture.output() function. The capture.output function will save the metadata for the raw input file. This is done because we want to track changes done to the input, and we want to capture the contents of the same dataframe at different points in time. That will enable us to save the values of metadata and compare them at different points:

# Save it in case we need to look at the metadata later on. 
OnlineRetail.Metadata <- capture.output(str(OnlineRetail))# print it now.  We can see that the capture.output contains the output of the original str function, and that there are 541,909 observations 
 

Set stringsAsFactors back to TRUE:

options(stringsAsFactors = T)

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