I have a block of code like this:
while(i < 35)
{
m<-strsplit(datalist[i],split=",")
m<-sapply(m,as.numeric)
m<-c(m)
dif<- m-eingabe
mnear<-sum(dif^2)
if(mnear < near)
{
near<-mnear
position<-i
}
i<-i+1
}
i
my problem is that WHILE
count only until 8 and not until 35. If I commnet if
statement It works correct till 35. ( I need this If statement in While) How can I solve this problem?
UPDATE
I am getting this warning message:
Error in if (mnear < near) { : missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In lapply(X = X, FUN = FUN, ...) : NAs introduced by coercion
2: In m - eingabe :
longer object length is not a multiple of shorter object length