[R] tree

Michael Lynn Fugate fugate at kanab.c3.lanl.gov
Thu Mar 21 02:06:24 CET 2002


I have a dataframe, y, with  1000 rows and 266 columns.  The first column
of y is a 2 level factor response; columns 2:266 are each ordinal
variables that can take on one of the values 1, 2, or 3.

I'm trying to fit a model with the calls:
(A) y.tree <- tree(pref~.,data=y,mindev=0,minsize=2)


(B) y.tree <- tree(pref~.,data=y,split='gini')

pref is the name of the factor response variable.

In (A) I can fit a model using only about 600 rows of y before getting the
error message below and in (B) I can only use about 100 rows of y before I
get the error message.  In both (A) and (B) I'm trying to use all 265

The error message is:
Error in "row.names<-.data.frame"(*tmp*, value = fit$node[1:n]) :
	duplicate row.names are not allowed

If instead of using tree() I use rpart() with the call

(C) y.part <- rpart(pref~.,data=y,method="class",parms=list(split="gini"))

the model can be fit using all the data in y, and no error messages.

Thanks in advance.


| Michael Fugate                         Phone:  (505) 667-0398  |
| Los Alamos National Laboratory         Fax:    (505) 665-5220  |
| Group: CCS-3,  Mail Stop: B265         e-mail: fugate at lanl.gov |
| Los Alamos, NM 87545                                           |

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