Re: [R] Parse error in xtabs

About this list Date view Thread view Subject view Author view

From: Peter Dalgaard BSA (p.dalgaard@biostat.ku.dk)
Date: Wed 04 Apr 2001 - 08:23:49 EST


Message-ID: <x28zlhmxl6.fsf@blueberry.kubism.ku.dk>

Andrew Perrin <aperrin@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@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@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view

This archive was generated by hypermail 2b30 : Fri 22 Jun 2001 - 18:58:38 EST