Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201977

change coefficient names in coefplot.glm()

$
0
0

I would like to plot a coefplot.glm() with costumized coefficient names.

Consider the following code:

coefplot::coefplot.glm(lm(rbinom(1000,1,.5) ~ rnorm(1000,50,2) + rbinom(1000,1,prob=0.63) + rpois(1000, 2)))

This works fine but gives me the original variable names; I would like to change them inside the coefplot.glm() call to c("x1", "x2", "x3", "Intercept"). [I am actually working with factorized data and renaming it isn't really easily possible - the renaming would be another imported vector]

I tried

coefplot::coefplot.glm(lm(rbinom(1000,1,.5) ~ rnorm(1000,50,2) + rbinom(1000,1,prob=0.63) + rpois(1000, 2)),
               newNames = c("1", "2", "3", "Interc"))

But this yields

Error in mapvalues(x, from = names(replace), to = replace, warn_missing = warn_missing) : from and to vectors are not the same length.


Viewing all articles
Browse latest Browse all 201977

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>