Add NAOK=T to the .C call in formatg. It won't help you much, though.
On Wed, 2 Jan 2002, Davies, Bob wrote:
> Any rpart user:
>
> I am trying to construct an rpart tree using a subset of the data and it
> will occasionally fail when predicting a categorical response variable.
>
> The reason that rpart fails is that the subset does not contain each of the
> categories present in the original data. For example, in the
car.test.frame
> example, a subset that has all the categories except "Small" will
not
> produce an rpart tree.
>
> I attempted to use "parms=list(prior=...) and it did not correct the
> problem.
>
> Here is a demonstration of the problem using the car.test.frame:
>
> library(rpart)
> data(car.test.frame)
> t1 <- rpart(Type ~ ., car.test.frame)
> t1
> sub <- row.names(car.test.frame[car.test.frame[,"Weight"] >
2567.5,]) #
> create a subset
> rpart (Type ~ ., car.test.frame, subset=sub ) # this statement will fail
>
> # so now attempt to indicate what the priors should look like:
> rpart (Type ~ ., car.test.frame, subset=sub,
> parms=list(prior=t1$parms$prior)) # this statement will fail
>
> # now add 1 "Small" car to this subset of car.test.frame
> sub <- row.names(car.test.frame[car.test.frame[,"Weight"] >
2559,]) # lower
> the weight just a little to get a "Small" car.
> rpart(Type ~ ., car.test.frame, subset=sub) # This statement will work !
>
> Any suggestions?
>
> I am using R 1.4.0 on Windows 2000.
>
> Bob Davies
>
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._