O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

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

Getting ready

If you have not already installed the class and caret packages, install them now. Download the data files for this chapter from the book's website and place the vacation-trip-classification.csv file in your R working directory. The knn function requires all the independent/predictor variables to be numeric and the dependent variable or target to be categorical. So, if needed, you should first convert variables accordingly--refer to the, Creating dummies for categorical variables and Binning numerical data recipes in Chapter 1, Acquire and Prepare the Ingredients - Your Data.

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