[R] Function knn.dist from knnflex library

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Apr 11 07:50:12 CEST 2007


On Wed, 11 Apr 2007, jmoreira at fe.up.pt wrote:

> Hello,
>
> I am feeling that this question can have a very simple answer, but I
> can't find it.
>
> I need to use the function knn.dist from knnflex library.
>
> Whatever I try, I get the error:
> Error in as.vector.dist(x, "character") : unused argument(s) ("character")
>
> First example:
>
>> a<-NULL
>> a<-rbind(a,c(5.2,-8.1))
>> a<-rbind(a,c(8.8,-16.1))
>> a<-rbind(a,c(10.5,-0.9))
>> knn.dist(a)
> Error in as.vector.dist(x, "character") : unused argument(s) ("character")
>>
>
> Second example (taken from the examples section of knn.dist help page):
>
>> x1 <- c(rnorm(20,mean=1),rnorm(20,mean=5))
>> x2 <- c(rnorm(20,mean=5),rnorm(20,mean=1))
>> x  <- cbind(x1,x2)
>> kdist <- knn.dist(x)
> Error in as.vector.dist(x, "character") : unused argument(s) ("character")
>>
>
> Am I doinhg something wrong? I can't understand. Any help is very much
> appreciated. Thanks in advance.

Your examples worked for me with R 2.5.0 beta and knnflex 1.1.

You haven't followed the advice in the posting guide, and we have no idea 
what version of R and what of knnflex this is, nor if there is any other 
packages attached.  (I did not find a function 'as.vector.dist' 
anywhere.)

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list