On Nov 17, 2009, at 10:55 AM, Greg Riddick wrote:
> >
> > 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])
>
> c s v
> 22 23 30
> > z <- lda(Sp ~ ., Iris, prior = c(1,1,1)/3, subset = train)
> Error in if (targetlist[i] == stringname) { : argument is of length
> zero
> >
> > sessionInfo()
> R version 2.10.0 (2009-10-26)
> i386-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] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] MASS_7.3-3
I wanted to see what version of MASS you were working with. As it
happens it is the same as the one I am using on with 64-bit R 2.10.0
RC (2009-10-20 r50178)
Running that code I get:
Call:
lda(Sp ~ ., data = Iris, prior = c(1, 1, 1)/3, subset = train)
Prior probabilities of groups:
c s v
0.3333333 0.3333333 0.3333333
Group means:
Sepal.L. Sepal.W. Petal.L. Petal.W.
c 5.880000 2.720000 4.180000 1.2960000
s 4.975000 3.450000 1.466667 0.2416667
v 6.773077 2.992308 5.650000 2.0153846
Coefficients of linear discriminants:
LD1 LD2
Sepal.L. 0.9923557 -0.3691204
Sepal.W. 0.9782821 -2.0843116
Petal.L. -1.9359728 0.4945675
Petal.W. -2.9221556 -1.4810518
Proportion of trace:
LD1 LD2
0.9888 0.0112
>
Does not appear to be the same sort of error as one gets with a
corrupt workspace image. Perhaps reinstalling MASS? You first need to
delete the MASS folder from the R.Frameworks/ version/
library ... .for me that is located here:
/Library/Frameworks/R.framework/Versions/2.10/Resources/library/MASS
If no luck then you probably need to repost on the Mac-SIG list with
the code, error and sessionInfo.
-- David>
>
> Doesn't seem to be a namespace problem:
>
> > lda
> function (x, ...)
> UseMethod("lda")
> <environment: namespace:MASS>
>
>
>
> -------------
> 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]]