From ggrothendieck at myway.com  Sat Aug 28 06:05:48 2004
From: ggrothendieck at myway.com (ggrothendieck@myway.com)
Date: Sat Aug 28 06:05:54 2004
Subject: [Rd] model.matrix.default chokes on backquote (PR#7202)
Message-ID: <20040828040548.11F6EF306@slim.kubism.ku.dk>

Full_Name: Gabor Grothendieck
Version: R version 1.9.1, 2004-08-03
OS: Windows XP
Submission from: (NULL) (207.35.143.52)



The following gives an error:

	> `a(b)` <- 1:4
	> `c(d)` <- (1:4)^2
	> lm(`a(b)` ~ `c(d)`)
	Error in model.matrix.default(mt, mf, contrasts) : 
        	model frame and formula mismatch in model.matrix()

To fix it replace this line in model.matrix.default:

	reorder <- match(attr(t, "variables")[-1], names(data))

with these two lines:

	strip.backquote <- function(x) gsub("^`(.*)`", "\\1", x)
	reorder <- match(strip.backquote(attr(t, "variables"))[-1], 
			strip.backquote(names(data)))


[Rd] model.matrix.default chokes on backquote (PR#7202)
ggrothendieck@myway.com