Hi,

This is my code (my data is attached):

library(languageR)
library(rms)
library(party)
OLDDATA <- read.csv("/Users/Abigail/Documents/OldData250412.csv")
OLDDATA$YD <- factor(OLDDATA$YD, label=c("Yes", "No")) 
OLDDATA$ND <- factor(OLDDATA$ND, label=c("Yes", "No")) 
attach(OLDDATA)
defaults <- cbind(YD, ND)
set.seed(47)
data.controls <- cforest_unbiased(ntree=500, mtry=3)
data.cforest <- cforest(defaults~LN+LV+LT+RV+MR+TL+DIA+CB, data = OLDDATA, 
controls=data.controls)
data.cforest.varimp <- varimp(data.cforest, conditional = TRUE)
barplot(sort(data.cforest.varimp))



And this is the error I get:

data.cforest <- cforest(defaults~LN+LV+LT+RV+MR+TL+DIA+CB, data = OLDDATA, 
controls=data.controls)
Error in xt[[j]][nas, drop = FALSE] <- 0 : 
  (subscript) logical subscript too long


Basically I want to reduce the number of factors I've got (9) to fewer, say the 
5 most important ones? Hence I imagined Random Forests would be a good idea. 
However I get the error given above. Is it possible to smarten up the code and 
correct the error? Or has anybody got other ideas of how I can reduce the 
amount of factors I have?

Kind regards,


AJC
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to