[Rd] Segfault from knn.cv in class package (PR#6856)
jmacdon at med.umich.edu
jmacdon at med.umich.edu
Wed May 5 03:53:38 CEST 2004
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
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)
[1] 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.
Best,
Jim
--please do not edit the information below--
Version:
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
734-647-5623
More information about the R-devel
mailing list