[R] problem with model.matrix

2004-06-24 Thread Trevor Hastie
This works: model.matrix(~I(pos3),data=data.frame(pos=c(1:5))) (Intercept) I(pos 3)TRUE 1 1 0 2 1 0 3 1 0 4 1 1 5 1 1 attr(,assign) [1] 0 1 attr(,contrasts)

Re: [R] problem with model.matrix

2004-06-24 Thread Peter Dalgaard
Trevor Hastie [EMAIL PROTECTED] writes: This does not: model.matrix(~I(pos3),data=data.frame(pos=c(1:2))) Error in contrasts-(`*tmp*`, value = contr.treatment) : contrasts can be applied only to factors with 2 or more levels Oh yes it does:

RE: [R] problem with model.matrix

2004-06-24 Thread Liaw, Andy
From: Peter Dalgaard Trevor Hastie [EMAIL PROTECTED] writes: This does not: model.matrix(~I(pos3),data=data.frame(pos=c(1:2))) Error in contrasts-(`*tmp*`, value = contr.treatment) : contrasts can be applied only to factors with 2 or more levels Oh yes it does: Ditto here.

Re: [R] problem with model.matrix

2004-06-24 Thread Balasubramanian Narasimhan
Trevor's problem is reproducible on R 1.8.1 (which is what he was using) on both Linux RHEL 3.0 and Solaris and R 1.8.0 on Windows. - Original Message - From: Trevor Hastie [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 24, 2004 3:12 PM Subject: [R] problem

Re: [R] problem with model.matrix

2004-06-24 Thread Berwin A Turlach
BN == Balasubramanian Narasimhan [EMAIL PROTECTED] writes: BN Trevor's problem is reproducible on R 1.8.1 (which is what he BN was using) on both Linux RHEL 3.0 and Solaris and R 1.8.0 on BN Windows. Yep, on my Linux box (details below) I have the same problem with R 1.8.1 but no