sknn(x, ...)
## S3 method for class 'default':
sknn(x, grouping, k = 3,...)
## S3 method for class 'data.frame':
sknn(x, ...)
## S3 method for class 'matrix':
sknn(x, grouping, ..., subset, na.action = na.fail)
## S3 method for class 'formula':
sknn(formula, data = NULL, ..., subset, na.action = na.fail)
formula
is not given).formula
is not given).groups ~ x1 + x2 + ...
.
That is, the response is the grouping factor and the right hand side specifies the (non-factor) discriminators.formula
are preferentially to be taken.NA
s are
found. The default action is for the procedure to fail. An
alternative is na.omit
, which leads to rejection of cases with
missing valuespredict.sknn
, knn
data(iris)
x <- sknn(Species ~ ., data = iris)
Run the code above in your browser using DataCamp Workspace