From the course: Complete Your First Project in R

Unlock the full course today

Join today to access over 24,000 courses taught by industry experts.

How to prepare data for classification

How to prepare data for classification

From the course: Complete Your First Project in R

How to prepare data for classification

- [Instructor] To begin your classification analysis, you will need to do a few things to prepare the data for the machine learning algorithms. First, make sure you run the top section of your code to load in the data. First, you will be creating two new columns of data with the order month and the order year. These will be more useful in the algorithms than having the exact dates. You can use the format function to do this. Begin by creating a new column called OrderMonth and you will assign this to the value you get by using the format function on the sales$OrderDate column. And for this one, you will want to have the value B% in uppercase B. This particular code is used to specify when you want to return the month name from a date. So if you look at the summary of this sales data, once you add in this new column, you can scroll down and now you see you have an OrderMonth column that is in a character format. You can copy and paste this code to then gather the order year. So you'll…

Contents