Greg Riddick
2009-Nov-15 00:02 UTC
[R] Error running lda example from Help File (MASS library )
Hello all, I'm trying to run lda() from the MASS library but the Help example generates the following error: #Code from example in lda Help file # Resulting Error>Error in if (targetlist[i] == stringname) { : argument is of length zeroMy Current R Installation: MacOSX: 10.5.8 R: 2.10.0 -- Gregory Riddick, PhD. CRTA Research Fellow National Institutes of Health National Cancer Institute, Neuro-Oncology Branch http://home.ccr.cancer.gov/nob/ 37 Convent Drive Building 37, Room 1142 Bethesda, MD 20892-8202 Phone: 301-443-2490 Fax: 240-396-5920 [[alternative HTML version deleted]]
Ronggui Huang
2009-Nov-15 07:06 UTC
[R] Error running lda example from Help File (MASS library )
I don't run into any problem when runing examples from lda help file.> sessionInfo()R version 2.10.0 Patched (2009-11-09 r50375) i386-pc-mingw32 locale: [1] LC_COLLATE=Chinese_People's Republic of China.936 [2] LC_CTYPE=Chinese_People's Republic of China.936 [3] LC_MONETARY=Chinese_People's Republic of China.936 [4] LC_NUMERIC=C [5] LC_TIME=Chinese_People's Republic of China.936 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] MASS_7.3-3 ASRR_0.0-1 ASAtable_0.0-1 QCA3_0.0-3 loaded via a namespace (and not attached): [1] car_1.2-16 tools_2.10.0 2009/11/15 Greg Riddick <riddickgp at mail.nih.gov>:> Hello all, > > I'm trying to run lda() from the MASS library but the Help example generates > the > following error: > > > #Code from example in lda Help file > > > > # Resulting Error > >>Error in if (targetlist[i] == stringname) { : argument is of length zero > > > My Current R Installation: > MacOSX: 10.5.8 > R: 2.10.0 > > > > > -- > Gregory Riddick, PhD. > CRTA Research Fellow > > National Institutes of Health > National Cancer Institute, Neuro-Oncology Branch > http://home.ccr.cancer.gov/nob/ > > 37 Convent Drive > Building 37, Room 1142 > Bethesda, MD 20892-8202 > > Phone: 301-443-2490 > Fax: 240-396-5920 > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Wincent Ronggui HUANG Doctoral Candidate Dept of Public and Social Administration City University of Hong Kong http://asrr.r-forge.r-project.org/rghuang.html
David Winsemius
2009-Nov-15 14:56 UTC
[R] Error running lda example from Help File (MASS library )
On Nov 14, 2009, at 7:02 PM, Greg Riddick wrote:> Hello all, > > I'm trying to run lda() from the MASS library but the Help example > generates > the following error: > > #Code from example in lda Help file > <no code included> > # Resulting Error > >> Error in if (targetlist[i] == stringname) { : argument is of length >> zeroCannot reproduce on setup possibly similar to yours: > sessionInfo() R version 2.10.0 Patched (2009-10-29 r50258) x86_64-apple-darwin9.8.0 locale: [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] splines stats graphics grDevices utils datasets methods base other attached packages: [1] MASS_7.3-3 plyr_0.1.9 survey_3.18 Design_2.3-0 Hmisc_3.7-0 [6] survival_2.35-7 lattice_0.17-26 loaded via a namespace (and not attached): [1] cluster_1.12.1 grid_2.10.0 tools_2.10.0> > My Current R Installation: > MacOSX: 10.5.8 > R: 2.10.0What is your sessionInfo(), requested in Posting Guide.> > -- > Gregory Riddick, PhD. > CRTA Research Fellow > > National Institutes of Health > National Cancer Institute, Neuro-Oncology Branch > http://home.ccr.cancer.gov/nob/ > > 37 Convent Drive > Building 37, Room 1142 > Bethesda, MD 20892-8202-- David Winsemius, MD Heritage Laboratories West Hartford, CT
Greg Riddick
2009-Nov-16 22:56 UTC
[R] Error running lda example from Help File (MASS library )
The actual code for the lda example is below. If anyone can reproduce the error, let me know. Thanks. library(MASS) Iris <- data.frame(rbind(iris3[,,1], iris3[,,2], iris3[,,3]), Sp = rep(c("s","c","v"), rep(50,3))) train <- sample(1:150, 75) table(Iris$Sp[train]) z <- lda(Sp ~ ., Iris, prior = c(1,1,1)/3, subset = train)>Error in if (targetlist[i] == stringname) { : argument is of length zeroSystem: MacOSX 10.5.8 R: 2.10.0 -- Gregory Riddick, PhD. CRTA Research Fellow National Institutes of Health National Cancer Institute, Neuro-Oncology Branch http://home.ccr.cancer.gov/nob/ 37 Convent Drive Building 37, Room 1142 Bethesda, MD 20892-8202 Phone: 301-443-2490 Fax: 240-396-5920 [[alternative HTML version deleted]]