Classifying using linear discriminant function analysis
MASS package contains the
lda function for classification using linear discriminant function analysis.
If you have not already installed the
caret packages, install them now. Download the data files for this chapter from the book's website and place the
banknote-authentication.csv file in your R working directory. We will use
class as our target or outcome variable, and all the remaining variables as predictors.
How to do it...
To classify using linear discriminant function analysis, follow these steps:
- Load the
> library(MASS) > library(caret)
- Read the data:
> bn <- read.csv("banknote-authentication.csv")
- Convert the outcome variable class to a ...