[R] Parse error in xtabs
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Wed Apr 4 00:23:49 CEST 2001
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list