[R] help with the usage of "randomForest"
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Wed Mar 31 19:38:39 CEST 2004
Hui Han <hhan at cse.psu.edu> 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
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list