Skip to content

Instantly share code, notes, and snippets.

@timcdlucas
Created September 10, 2018 12:27
Show Gist options
  • Save timcdlucas/eac14f7c44b589cbe5bac059e456116e to your computer and use it in GitHub Desktop.
Save timcdlucas/eac14f7c44b589cbe5bac059e456116e to your computer and use it in GitHub Desktop.
imp <- list()
for(i in 1:50){
r <- randomForest::randomForest(mpg ~ ., data = mtcars, importance = TRUE)
m <- lm(mpg ~ ., data = mtcars)
m %>% summary
imp[[i]] <- r$importance[,1]
}
imp.df <- do.call(rbind, imp) %>% data.frame
imp.df %>%
gather(variable, importance) %>%
ggplot(aes(x= variable, y = importance)) +
geom_boxplot()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment