klaR (version 0.3-0)

predict.sknn: Simple k Nearest Neighbours Classification

Description

Classifies new observations using the sknn learned by the sknn-function.

Usage

## S3 method for class 'sknn':
predict(object, newdata,...)

Arguments

object
Object of class sknn.
newdata
Data frame (or matrix) of cases to be classified.
...
...

Value

  • A list with elements class and posterior.

See Also

sknn, knn

Examples

Run this code
data(iris)
x <- sknn(Species ~ ., data = iris)
predict(x, iris)

Run the code above in your browser using DataCamp Workspace