Skip to content

Parse error in xtabs

3 messages · Peter Dalgaard, Andrew Perrin

#
Greetings-

Using R 1.2.2 under linux, I get the following:
+                    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:
data=gt)
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:
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:
+  r.logic.enlightened, r.logic.capacity,
+  r.logic.mediate) ~grouptype)
expression(cbind(r.logic.interests, r.logic.morality, r.logic.enlightened, 
    r.logic.capacity, r.logic.mediate) ~ grouptype)
#
Well, for whatever reason debug() isn't stepping through for me:
r.logic.morality,r.logic.enlightened, r.logic.capacity,r.logic.mediate)~
grouptype,data=gt))
Error in parse(file, n, text, prompt) : parse error
11: parse(text = x)
10: eval(parse(text = x)[[1]])
9: formula(eval(parse(text = x)[[1]]))
8: switch(mode(x), "NULL" = structure(NULL, class = "formula"), 
       character = formula(eval(parse(text = x)[[1]])), call = eval(x), 
       stop("invalid formula"))
7: formula.default(paste(lhs, "~", rhs))
6: formula(paste(lhs, "~", rhs))
5: fixFormulaObject(tmp)
4: terms.formula(formula)
3: terms(formula)
2: any(attr(terms(formula), "order") > 1)
1: xtabs(cbind(r.logic.interests, r.logic.morality, r.logic.enlightened, 
       r.logic.capacity, r.logic.mediate) ~ grouptype, data = gt)
Interestingly enough, the behavior is the same under R 1.2.2 under
Solaris and linux, but NOT under Windows. I solved the problem for the
short term by save()ing the data and opening it on a Windows machine to do
the analyses. Ugh.

----------------------------------------------------------------------
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
On 4 Apr 2001, Peter Dalgaard BSA wrote:

            
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._