Hui Han <[EMAIL PROTECTED]> writes:

> Thinking that the following suggestions by Matt may be helpful to others,
> I am fowarding his notes to R-list.

<Did you ask for permission? You really should.>

> On Wed, Mar 31, 2004 at 08:57:13AM -0800, Austin, Matt wrote:
> > Use na.action=na.omit in your function call to delete those rows, but this
> > can give you problems if you want to use follow-up methods such as the
> > partial.plot(). This is what I usually do:
> > 
> > naRows <- apply(data2, 1, function(x) any(is.na(x)))
> > 
> > sum(!(naRows))
> > 
> > data2.noNAs <- data2[!naRows,]
> > 
> > chg.rf <- randomForest(ch13 ~ .,data=data2.noNAs, importance=TRUE,
> > keep.forest=TRUE)

Actually, data2.noNAs <- na.omit(data2) will do the trick and !naRows
is the same as complete.cases(data2).

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])             FAX: (+45) 35327907

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to