Your code seems to be screwed up. There are no (small) size limitations on formulas (afaik).
The following worked fine for me: x <- paste("x",1:100,sep="",collapse = " + ") part1 <- paste("y",x,sep=" ~ ") part2 <- paste("f",1:50, sep="",collapse = " + ") fml <- formula(paste(part1,part2,sep=" | ")) Cheers, Bert On Tue, Feb 28, 2012 at 11:11 AM, Chris Hane <christopher.a.h...@gmail.com> 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? > > [[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. -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm ______________________________________________ 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.