When I typed the command for importance as below importance ( model.rf
) I get this error:
Error in UseMethod("importance") : no applicable method for 'importance' applied to an object of class "c('randomForest.formula', 'randomForest')"
How to solve this error?
output.forest <- randomForest(nativeSpeaker ~ age + shoeSize + score, data =
readingSkills,importance=TRUE)
#You can use like this - Solution
out.importance <- round(importance(output.forest), 2)
print(out.importance )
first convert importance to variable and then print that out.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.