Re: [R] formula behaviour in model.matrix

2005-02-11 Thread Prof Brian Ripley
See MASS4 pp.149-150 (and I don't know of a similarly detailed explanation elsewhere, although there is a terser account in the White Book). On Fri, 11 Feb 2005, Sundar Dorai-Raj wrote: > Hi all, > > Perhaps somebody can explain the following behaviour to me. > > Take the following data.frame. >

[R] formula behaviour in model.matrix

2005-02-11 Thread Sundar Dorai-Raj
Hi all, Perhaps somebody can explain the following behaviour to me. Take the following data.frame. z <- expand.grid(X = LETTERS[1:3], Y = letters[1:3]) Now, from ?formula we see: The '*' operator denotes factor crossing: 'a*b' interpreted as 'a+b+a:b'. So I would expect the following: ncol(model.