Greetings- Using R 1.2.2 under linux, I get the following:> l.agg<-xtabs(cbind(r.logic.interests, r.logic.morality,+ r.logic.enlightened, r.logic.capacity, r.logic.mediate) + ~ grouptype, + data=gt) Error in parse(file, n, text, prompt) : parse error I know the data are structured fine, as I can use all the elements in individual xtabs() calls such as the one below:> l.agg<-xtabs(cbind(r.logic.morality,r.logic.capacity) ~ grouptype,data=gt)> summary(l.agg)Call: xtabs(formula = cbind(r.logic.morality, r.logic.capacity) ~ grouptype, data = gt) Number of cases in table: 693 Number of factors: 2 Test for independence of all factors: Chisq = 5.447, df = 4, p-value = 0.2444 Any advice? Thanks. ---------------------------------------------------------------------- Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology (Soon: Asst Professor of Sociology, U of North Carolina, Chapel Hill) andrew_perrin at unc.edu - http://www.unc.edu/~aperrin -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Andrew Perrin <aperrin at socrates.berkeley.edu> writes:> Greetings- > > Using R 1.2.2 under linux, I get the following: > > l.agg<-xtabs(cbind(r.logic.interests, r.logic.morality, > + r.logic.enlightened, r.logic.capacity, > r.logic.mediate) > + ~ grouptype, > + data=gt) > Error in parse(file, n, text, prompt) : parse error > > > I know the data are structured fine, as I can use all the elements in > individual xtabs() calls such as the one below: > > > l.agg<-xtabs(cbind(r.logic.morality,r.logic.capacity) ~ grouptype, > data=gt) > > summary(l.agg) > Call: > xtabs(formula = cbind(r.logic.morality, r.logic.capacity) ~ grouptype, > data = gt) > Number of cases in table: 693 > Number of factors: 2 > Test for independence of all factors: > Chisq = 5.447, df = 4, p-value = 0.2444 > > Any advice?You might try debugging it further with traceback() and debug(). It's pretty difficult to pinpoint the cause from the information you give. In particular, what is in "text" at the point of the crash? My first guess was that it was parse having trouble with the argument length, but apparently not:> x <- (cbind(r.logic.interests, r.logic.morality,+ r.logic.enlightened, r.logic.capacity, + r.logic.mediate) ~grouptype)> parse(text=deparse(x))expression(cbind(r.logic.interests, r.logic.morality, r.logic.enlightened, r.logic.capacity, r.logic.mediate) ~ grouptype) -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Okay, here's the output done the right way :). I notice that the ~ grouptype shows up in both elements of the text vector - perhaps that's a problem. Andy Perrin> debug(parse) > l.agg<-xtabs(cbind(r.logic.interests, r.logic.morality,+ r.logic.enlightened, r.logic.capacity,r.logic.mediate) ~ grouptype, + data=gt) debugging in: parse(text = x) debug: { if (is.character(file)) if (file == "") file <- stdin() else { file <- file(file, "r") on.exit(close(file)) } .Internal(parse(file, n, text, prompt)) } Browse[1]> text [1] "cbind(r.logic.interests, r.logic.morality, r.logic.enlightened, ~ grouptype" [2] " r.logic.capacity, r.logic.mediate) ~ grouptype" Browse[1]> n debug: if (is.character(file)) if (file == "") file <- stdin() else { file <- file(file, "r") on.exit(close(file)) } Browse[1]> n debug: .Internal(parse(file, n, text, prompt)) Browse[1]> n Error in parse(file, n, text, prompt) : parse error Peter Dalgaard BSA wrote:> > Andrew Perrin <aperrin at socrates.berkeley.edu> writes: > > > Well, for whatever reason debug() isn't stepping through for me: > > > > > > > debug(xtabs(cbind(r.logic.interests, > > r.logic.morality,r.logic.enlightened, r.logic.capacity,r.logic.mediate)~ > > grouptype,data=gt)) > > Error in parse(file, n, text, prompt) : parse error > > That's not the way to do it: > > debug(parse) > > xtabs(cbind(r.logic.interests, > r.logic.morality,r.logic.enlightened, r.logic.capacity,r.logic.mediate)~ > grouptype,data=gt) > > -- > O__ ---- Peter Dalgaard Blegdamsvej 3 > c/ /'_ --- Dept. of Biostatistics 2200 Cph. N > (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 > ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907-- -------------------------------------------------------------- Andrew J. Perrin - Programmer/Analyst, Desktop Support Children's Primary Care Research Group, UNC - Chapel Hill (919)966-9394 * andrew_perrin at unc.edu -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._