[Rd] Segfault from knn.cv in class package (PR#6856)
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed May 5 07:57:06 CEST 2004
This is user error.
R-bugs is not the appropriate place to report user error in a contributed
package -- please do read the R FAQ.
On Wed, 5 May 2004 jmacdon at med.umich.edu wrote:
> The function knn.cv in the class package doesn't have error checking to
> ensure that the length of the classlabel argument is equal to the number
> of rows in the test set. If the classlabel is short, the result is often
There is no *test* set in knn.cv, nor is there a `classlabel argument'.
cl: factor of true classifications of training set
and that has been specified incorrectly.
> a segfault.
> > library(class)
> > dat <- matrix(rnorm(1000), nrow=10)
> > cl <- c(rep(1,5), rep(2,5))
> > cl2 <- c(rep(1,5), rep(2,4))
> > knn.cv(dat, cl)
>  2 2 1 2 1 2 2 2 2 2
> Levels: 1 2
> > knn.cv(dat, cl2) # May have to try more than once to get segfault.
> This also occurs on my linux box.
> --please do not edit the information below--
> platform = i386-pc-mingw32
> arch = i386
> os = mingw32
> system = i386, mingw32
> status =
> major = 1
> minor = 9.0
> year = 2004
> month = 04
> day = 12
> language = R
> Windows XP Professional (build 2600) Service Pack 1.0
> Search Path:
> .GlobalEnv, package:methods, package:stats, package:graphics,
> package:utils, Autoloads, package:base
> James W. MacDonald
> Affymetrix and cDNA Microarray Core
> University of Michigan Cancer Center
> 1500 E. Medical Center Drive
> 7410 CCGC
> Ann Arbor MI 48109
> R-devel at stat.math.ethz.ch mailing list
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-devel