[R] Error: object is not a matrix
Albert Kim
alkim at u.washington.edu
Thu Aug 22 20:39:12 CEST 2002
Hi,
I have encountered the following error, when using 'aov', which I think
has something to do with the length of my call to 'aov', and I cannot
understand why:
Error in model.frame.default(formula = Y2 ~ P2 + P2:AAAAAAAA +
P2:B2 + :
object is not a matrix
The error occurs when I run the first sequence below, but not the
second. The two sequences are based on the SAME data, but in one
case, the variable names are longer [Although I don't think the nature
of my analysis is relevant here, it is a 3-way repeated measures
ANOVA; the "P" factor is a random factor for participants in an
experiment and the A,B,C factors are factorially crossed within P].
## RESULTS IN ERROR:
> AK2.df <<- read.table("foo.data", col.names = c("Y2",
"P2","AAAAAAAA","B2","C2"))
> AK2.df$P2 <- as.factor(AK2.df$P2)
> attach(AK2.df)
> AK2anova.out <- aov(Y2 ~ AAAAAAAA * B2 * C2 + Error(P2 + P2:AAAAAAAA +
P2:B2 + P2:C2 + P2:AAAAAAAA:B2 + P2:AAAAAAAA:C2 + P2:B2:C2 +
P2:AAAAAAAA:B2:C2), data=AK2.df)
Error in model.frame.default(formula = Y2 ~ P2 + P2:AAAAAAAA + P2:B2 + :
object is not a matrix
## IDENTICAL ANALYSIS WITH DIFFERENT VARIABLE NAMES DOES NOT PRODOCE
ERROR:
> AK.df <<- read.table("foo.data", col.names = c("Y", "P","A","B","C"))
> AK.df$P <- as.factor(AK.df$P)
> attach(AK.df)
> AKanova.out <- aov(Y ~ A * B * C + Error(P + P:A + P:B + P:C + P:A:B +
P:A:C + P:B:C + P:A:B:C), data=AK.df)
I have reproduced this error in a number of ways, and the only common
characteristic I can see to my actions is that the length of the call
to 'aov' is always too long: either one of the variable names is too
long, or I include too many error terms, etc...).
Any help would be appreciated,
Al Kim
Research Scientist
Department of Psychology
University of Washington, Box 351525
Seattle, WA. 98195, USA
E-Mail: alkim at u.washington.edu; Tel: (206)543-2395
Included below is the data I'm using.
> AK.df
Y P A B C
1 10 1 E1 Red Agent
2 9 1 E1 Red Patient
3 0 1 E1 Unred Agent
4 0 1 E1 Unred Patient
5 5 1 E2 Red Agent
6 6 1 E2 Red Patient
7 0 1 E2 Unred Agent
8 0 1 E2 Unred Patient
9 8 2 E1 Red Agent
10 9 2 E1 Red Patient
11 0 2 E1 Unred Agent
12 0 2 E1 Unred Patient
13 4 2 E2 Red Agent
14 4 2 E2 Red Patient
15 0 2 E2 Unred Agent
16 0 2 E2 Unred Patient
17 12 3 E1 Red Agent
18 11 3 E1 Red Patient
19 2 3 E1 Unred Agent
20 0 3 E1 Unred Patient
21 6 3 E2 Red Agent
22 7 3 E2 Red Patient
23 0 3 E2 Unred Agent
24 0 3 E2 Unred Patient
> AK2.df
Y2 P2 AAAAAAAA B2 C2
1 10 1 E1 Red Agent
2 9 1 E1 Red Patient
3 0 1 E1 Unred Agent
4 0 1 E1 Unred Patient
5 5 1 E2 Red Agent
6 6 1 E2 Red Patient
7 0 1 E2 Unred Agent
8 0 1 E2 Unred Patient
9 8 2 E1 Red Agent
10 9 2 E1 Red Patient
11 0 2 E1 Unred Agent
12 0 2 E1 Unred Patient
13 4 2 E2 Red Agent
14 4 2 E2 Red Patient
15 0 2 E2 Unred Agent
16 0 2 E2 Unred Patient
17 12 3 E1 Red Agent
18 11 3 E1 Red Patient
19 2 3 E1 Unred Agent
20 0 3 E1 Unred Patient
21 6 3 E2 Red Agent
22 7 3 E2 Red Patient
23 0 3 E2 Unred Agent
24 0 3 E2 Unred Patient
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list