R/KNN.R

KNN <-
function(train,test,g,k=1,prob=TRUE,use.all=TRUE){
#
# Do classification using the kNN method
#
# 
# train is the training set
# test is the test data
# g contains labels for the data in the training set,  
#
# This function removes the need to call library class.
# For more information, use the command ?knn
#
library(class)
res=knn(train,test,cl=as.factor(g),k=k,prob=prob)
res
}
musto101/wilcox_R documentation built on May 23, 2019, 10:52 a.m.