[R] How to deal with missing values when using Random Forrest

kevin123
Sat, 25 Feb 2012 23:24:07 -0000

I am using the package Random Forrest to test and train a model,
I aim to predict (LengthOfStay.days),:

> library(randomForest)
> model <- randomForest( LengthOfStay.days~.,data = training,
+ importance=TRUE,
+ keep.forest=TRUE
+ )


*This is a small portion of the data frame:   *

*data(training)*

LengthOfStay.days CharlsonIndex.numeric DSFS.months
1                  0                   0.0         8.5
6                  0                   0.0         3.5
7                  0                   0.0         0.5
8                  0                   0.0         0.5
9                  0                   0.0         1.5
11                 0                   1.5         NaN



*Error message*

Error in na.fail.default(list(LengthOfStay.days = c(0, 0, 0, 0, 0, 0,  :
  missing values in object,

I would greatly appreciate any help

Thanks

Kevin


--
View this message in context:
http://r.789695.n4.nabble.com/How-to-deal-with-missing-values-when-using-Random-Forrest-tp4421254p4421254.html
Sent from the R help mailing list archive at Nabble.com.