Facing Error with command multiplot from coefplot package in R -
is there facing same when running command multiplot rpackage coefplot?
even example:
data(diamonds) model1 <- lm(price ~ carat + cut, data=diamonds) model2 <- lm(price ~ carat + cut + color, data=diamonds) model3 <- lm(price ~ carat + color, data=diamonds) multiplot(model1, model2, model3) i´m getting below error:
error in get(x, envir = this, inherits = inh)(this, ...) : attempt apply non-function any hint?
this answer bit tangential, have found more recent combination of broom , dotwhisker packages useful - broom end (converting models "tidy" data frames of coefficients) , dotwhisker front end (creating plots via thin ggplot2 layer)
library(ggplot2) library(dotwhisker) library(broom) update: re-installed dotwhisker v 0.2.0.3, appears work:
dwplot(list(model1,model2,model3)) you can dwplot(list(m1=model1,m2=model2,m3=model3)) if want pick different model names on fly.
alternatively, finer control can construct full data frame yourself:
mlist <- list(carat_cut=model1, carat_cut_color=model2, carat_color=model3) library(plyr) ## extract tidy data frames , combine them ... mframe <- ldply(mlist,tidy,conf.int=true,.id="model") now can do
dwplot(mframe)
Comments
Post a Comment