[R] rpart question
Joshua Wiley
jwiley.psych at gmail.com
Mon Jan 9 02:41:20 CET 2012
Hi Amanda,
Can you reproduce the error with a small subset of the data? If so,
could you send it to us? For instance if say 20 cases is sufficient,
you could send the output of dput() which pastes easily into the
console:
dput(yourdata[, c("ENROLL_YN", "MINORITY")])
You could also try calling traceback() after the error to get a bit
more diagnostics (and post those if they do not make any sense or help
you).
Hope this helps,
Josh
On Sun, Jan 8, 2012 at 1:48 PM, Amanda Marie Elling <elling at stolaf.edu> wrote:
> We are trying to make a decision tree using rpart and we are continually
> running into the following error:
>
>> fit_rpart=rpart(ENROLL_YN~MINORITY,method="class")
>> summary(fit_rpart)
> Call:
> rpart(formula = ENROLL_YN ~ MINORITY, method = "class")
> n= 5725
>
> CP nsplit rel error
> 1 0 0 1
> Error in yval[, 1] : incorrect number of dimensions
>
> ENROLL_YN is a categorical variable with two options- yes or no.
> MINORITY is also a categorical variable with two options- 0 or 1.
>
> We have confirmed that all variables are the same length and there are no
> NAs.
>
> Does anyone have any ideas that might help?? All thoughts would be
> appreciated, thanks!
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
--
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/
More information about the R-help
mailing list