- using R Under development (unstable) (2012-02-23 r58468)
- using platform: i686-pc-linux-gnu (32-bit)
- using session charset: UTF-8
- checking for file ‘knnflex/DESCRIPTION’ ... OK
- checking extension type ... Package
- this is package ‘knnflex’ version ‘1.1.1’
- checking package dependencies ... OK
- checking if this is a source package ... OK
- checking if there is a namespace ... NOTE
As from R 2.14.0 all packages need a namespace.
One will be generated on installation, but it is better to handcraft a
NAMESPACE file: R CMD build will produce a suitable starting point.
- checking for executable files ... OK
- checking whether package ‘knnflex’ can be installed ... OK
- checking installed package size ... OK
- checking package directory ... OK
- checking for portable file names ... OK
- checking for sufficient/correct file permissions ... OK
- checking DESCRIPTION meta-information ... OK
- checking top-level files ... OK
- checking index information ... OK
- checking package subdirectories ... OK
- checking R files for non-ASCII characters ... OK
- checking R files for syntax errors ... OK
- checking whether the package can be loaded ... OK
- checking whether the package can be loaded with stated dependencies ... OK
- checking whether the package can be unloaded cleanly ... OK
- checking for unstated dependencies in R code ... OK
- checking S3 generic/method consistency ... OK
- checking replacement functions ... OK
- checking foreign function calls ... OK
- checking R code for possible problems ... OK
- checking Rd files ... OK
- checking Rd metadata ... OK
- checking Rd cross-references ... OK
- checking for missing documentation entries ... OK
- checking for code/documentation mismatches ... OK
- checking Rd \usage sections ... OK
- checking Rd contents ... OK
- checking for unstated dependencies in examples ... WARNING
‘library’ or ‘require’ call not declared from: ‘class’
- checking examples ... ERROR
Running examples in ‘knnflex-Ex.R’ failed
The error most likely occurred in:
> ### Name: knn.dist
> ### Title: Calculates the distances to be used for KNN predictions
> ### Aliases: knn.dist
> ### Keywords: methods
>
> ### ** Examples
>
> #a quick classification example
> # a quick classification example
> x1 <- c(rnorm(20,mean=1),rnorm(20,mean=5))
> x2 <- c(rnorm(20,mean=5),rnorm(20,mean=1))
> x <- cbind(x1,x2)
> y <- c(rep(1,20),rep(0,20))
> train <- sample(1:40,30)
> # plot the training cases
> plot(x1[train],x2[train],col=y[train]+1,xlab="x1",ylab="x2")
> # predict the other cases
> test <- (1:40)[-train]
> kdist <- knn.dist(x)
> preds <- knn.predict(train,test,y,kdist,k=3,agg.meth="majority")
> # add the predictions to the plot
> points(x1[test],x2[test],col=as.integer(preds)+1,pch="+")
> # display the confusion matrix
> table(y[test],preds)
preds
0 1
0 4 0
1 0 6
>
>
> # the iris example used by knn(class)
> library(class)
Error in library(class) : there is no package called ‘class’
Execution halted