0

I am trying to do prediction using kNN regression in R. I have two variable (X,Y) in excel table format (total 800 data-sets in each variable). My aim is to predict the value of Y (present in Test table) So for that I have written code in R as follows,

Table <-read.csv("Table.csv")
Y <-Table[1,];X <-Table[2,];
data_norm<-function(x){((x-min(x))/(max(x)-min(x)))}
Table_norm<-as.data.frame(laaply(Table),data_norm)
Train<-Table(1:30)
Test<-Table(31:49)
library(class)
ypred= <-knn(TRain,Test,Test[1:30,1],k=20)

I have attached the sample of data in Table format attached here3

While doing so I am getting the following error, 'Error in laaply(Table) : could not find function "laaply" '. The information about laaply is here.

I want to use above Table 1st 3o data points for training the kNN model and then rest of data points to predict the value of Y for given x

I did all search and try to solve such problem but not able to solve this problem.

Ankita
  • 485
  • 5
  • 18
  • 3
    Or even `lapply`? Without a working example it is hard to say for certain, but it seems to be just a simple typo giving you the error. – AkselA Oct 07 '17 at 10:15
  • @MarcoSandri what is `laply`? – mtoto Oct 07 '17 at 10:16
  • No it is laaply not laply. See this https://www.rdocumentation.org/packages/base/versions/3.4.1/topics/lapply – Ankita Oct 07 '17 at 11:51
  • Your question does not contain a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) (MCVE). This makes it hard to understand and answer your question. Please share relevant code, a small excerpt of your data and the expected outcome. You can find detailed information on how to create a goo MCVE for R [here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – Eric Fail Oct 07 '17 at 12:24
  • I added the sample of data sets and modified as per your suggestion please have a look – Ankita Oct 07 '17 at 12:45

0 Answers0