s-news
[Top] [All Lists]

Re: [S] RPART

To: "Barker, Chris {GL P~Palo Alto}" <CHRIS.BARKER@roche.com>
Subject: Re: [S] RPART
From: Prof Brian D Ripley <ripley@stats.ox.ac.uk>
Date: Fri, 29 Jan 1999 21:18:54 +0000 (GMT)
Cc: "'s-news@wubios.wustl.edu'" <s-news@wubios.wustl.edu>
In-reply-to: <B9E51B9719BDD111AB640000F80197CDBEA99A@rplmsem2.pal.roche.com>
Sender: owner-s-news@wubios.wustl.edu
On Fri, 29 Jan 1999, Barker, Chris {GL P~Palo Alto} wrote:

> 
> I have frequently used RPART without problems. However, I've started to
> encounter a problem with RPART detecting NAN's in my data even though
> I don't appear to have any in the variables I'm using.  Any suggestions on
> "debugging" my data appreciated.
> 
> > quick <- data.frame(bpd24, wt.4, bpd1, bpd12)
> > summary(quick)
>       bpd24             wt.4             bpd1            bpd12       
>     Min.: 41.00      Min.: 61.00      Min.: 48.00      Min.: 48.00  
>  1st Qu.: 70.00   1st Qu.: 88.80   1st Qu.: 72.00   1st Qu.: 71.00  
>   Median: 80.00    Median: 98.50    Median: 80.00    Median: 80.00  
>     Mean: 78.47      Mean: 99.58      Mean: 79.05      Mean: 78.71  
>  3rd Qu.: 85.00   3rd Qu.:109.10   3rd Qu.: 85.00   3rd Qu.: 85.00  
>     Max.:120.00      Max.:155.50      Max.:120.00      Max.:120.00  
>     NA's:710.00      NA's: 20.00      NA's: 30.00      NA's:403.00  
> > fit.bpd <- rpart(bpd24 ~ wt.4 + bpd1 + bpd12, control = rpart.control(cp =
> 
>       0.005))
> Error in .C("s_to_rp",: subroutine s_to_rp: 126 NaN value(s) in argument 10
> Dumped

The usual story is that those NAs are really NaNs. You can't tell at the
S level, but the .C interface can, and it objects to NaNs unless told
not to.

Try 

bpd24[is.na(bpd24)] <- NA

etc and see if you see any difference.

You can probably add specialsok=T to the .C("s_to_rp" call, but
don't rely on this, as I have not tested it.

-- 
Brian D. Ripley,                  ripley@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

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>
  • [S] RPART, Barker, Chris {GL P~Palo Alto}
    • Re: [S] RPART, Prof Brian D Ripley <=