Classification is a supervised task , where we need preclassified data and then on new data , I can predict.
Generally we holdout a % from the data available for testing and we call them training and testing data respectively. So it’s like this , if we know which emails are spam , then only using classification we can predict the emails as spam.
I used the dataset http://archive.ics.uci.edu/ml/datasets/seeds# . The data set has 7 real valued attributes and 1 for predicting . http://www.jeffheaton.com/2013/06/basic-classification-in-r-neural-networks-and-support-vector-machines/ has influenced many of the writing , probably I am making it more obvious.
The library to be used is library(nnet) , below are the list of commands for your reference
seedstest <- setdiff(1:210,seedstrain)
ideal <- class.ind(seeds$Class)
seedsANN = nnet(irisdata[seedstrain,-8], ideal[seedstrain,], size=10, softmax=TRUE)
predict(seedsANN, seeds[seedstrain,-8], type="class")
table(predict(seedsANN, seeds[seedstest,-8], type="class"),seeds[seedstest,]$Class)
Happy Coding !