# Simulate data and labels
set.seed(123)
X <- matrix(rnorm(100 * 10), 100, 10)
labels <- factor(rep(1:2, each = 50))
# Perform LDA and create a discriminant projector
lda_fit <- MASS::lda(X, labels)
dp <- discriminant_projector(lda_fit$scaling, X %*% lda_fit$scaling, sdev = lda_fit$svd,
labels = labels)
Run the code above in your browser using DataLab