Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing the Factor's Name from the Plot #8

Open
vsaulys opened this issue Apr 4, 2014 · 1 comment
Open

Removing the Factor's Name from the Plot #8

vsaulys opened this issue Apr 4, 2014 · 1 comment

Comments

@vsaulys
Copy link

vsaulys commented Apr 4, 2014

Found an easy way to remove the base factor name when plotting only the coefficients of a factor:

since this is ggplot2, I can just add a function to label the y axis that removes the factor name that appears in the beginning of the coefficient. It uses the str_replace function from stringr.

coefplot(model,
sort = "magnitude",
predictors = iPredictor,
decreasing = FALSE) +
scale_y_discrete(label=function(x) { str_replace(x, iPredictor, "") } )

Perhaps this can be added into the codebase to do this automatically?

@jaredlander
Copy link
Owner

Doing a straight up replace can be problematic in edge cases such as a factor called iPredictor and a continuous variable called iPredictors.

For now, check out the newNames argument which lets you specify new names for specific coefficients.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants