On 12-02-28 2:11 PM, Chris Hane wrote:
Hello,

I am trying to "paste" together a formula to use in the mob function of
party. This means the formula will be of the form y ~ x1+ ...+xM | z1+..zN.

I am doing some preliminary fits of y ~ x1+ ...+xM, then want to add the
conditional part of the equation using update().

Here's the test code:
var1<- 1:78
x1<- paste("x", var1, sep="")
f1<- paste("f", var1[1:10], sep="")

# use first 77 variables
fmla<- as.formula( paste("y ~ ", paste(x1[1:77], collapse=" + ", sep=""),
sep=""))
fmla2<- update(fmla, paste(". ~ . | ", paste(f1, collapse= " + "), sep=""))

# CHANGE x to all 78 variables
fmla<- as.formula( paste("y ~ ", paste(x1, collapse=" + ", sep=""),
sep=""))
fmla2<- update(fmla, paste(". ~ . | ", paste(f1, collapse= " + "), sep=""))

I have run this in Windows and Linux (64 bit) and both fail when using all
78 terms (and anything more than 78 terms). The error message contains
Error in parse(text = x) : :1:514: unexpected ')'.

Changing the length of the names of the x variables will break the update()
with fewer variables, but always with an error referring to just more than
512 characters.  There is nothing special about 77 or 78 variables here; I
want to do this with hundreds of variables.

Is there a workaround to this?

I've just committed code to R-devel (to become 2.15.0 at the end of the month) to remove the truncation. I don't know any workaround that will address this in earlier versions, other than "don't use very long formulas".

It also affects as.character() applied to a formula object, and some other cases where very long language objects are displayed.

Please test R-devel or one of the alpha/beta versions once they are built; this fix went into revision 58544.

Duncan Murdoch


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to