[R] Can I use random Forest package?

Sarah Goslee sarah.goslee at gmail.com
Thu Apr 19 12:07:21 CEST 2012


Hi Graeme,

We need more information, at the very least str(train) and better would be enough of train included in your email using dput() that we could try your code. It's likely that you do have missing data, or that your data are in the wrong format.

Sarah

On Apr 18, 2012, at 7:46 PM, vilike85 <gt28 at st-andrews.ac.uk> wrote:

> Hello R Help,
> 
> I have a data set with 30 variables, some of these variables are factors
> while some are numeric. My response variable is binary and I have made sure
> that this is set as a factor with two levels and given each level a name
> "Yes" and "No". I would like to run the randomPackage to discover variable
> importance but when ever I try the following code:
> 
> model <- randomForest(IsBadBuy~. ,
>                  data = train,
>                  importance=TRUE,
>                  keep.forest=TRUE)
> 
> I am given the response:
> 
> Error in na.fail.default(list(IsBadBuy = c(1L, 1L, 1L, 2L, 1L, 1L, 1L,  : 
>  missing values in object
> 
> However, I have gone through all of my variables and I have not found one
> single missing value. 
> 
> Can someone please advise me?
> 
> Thank you in advance
> 
> Graeme
> 
> 



More information about the R-help mailing list