Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 711815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:46:40+00:00 2026-05-14T04:46:40+00:00

I am trying to make a faceted plot in ggplot2 of the coefficients on

  • 0

I am trying to make a faceted plot in ggplot2 of the coefficients on the regressors from
two linear models with the same predictors. The data frame I constructed is this:

r.together>
          reg         coef        se      y
1  (Intercept)  5.068608671 0.6990873 Labels
2     goodTRUE  0.310575129 0.5228815 Labels
3    indiaTRUE -1.196868662 0.5192330 Labels
4    moneyTRUE -0.586451273 0.6011257 Labels
5     maleTRUE -0.157618168 0.5332040 Labels
6  (Intercept)  4.225580743 0.6010509  Bonus
7     goodTRUE  1.272760149 0.4524954  Bonus
8    indiaTRUE -0.829588862 0.4492838  Bonus
9    moneyTRUE -0.003571476 0.5175601  Bonus
10    maleTRUE  0.977011737 0.4602726  Bonus

The “y” column is a label for the model, reg are the regressors and coef and se are what you would think.

I want to plot:

g <- qplot(reg, coef, facets=.~y, data = r.together) + coord_flip() 

But when I try to display the plot, I get:

> print(g)
Error in names(df) <- output : 
'names' attribute [2] must be the same length as the vector [1]

What’s strange is that

qplot(reg, coef, colour=y, data = r.together) + coord_flip()

plots as you would expect.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:46:41+00:00Added an answer on May 14, 2026 at 4:46 am

    I don’t know why, but the name y seems to be the problem. If you change it, then it works

    r.together <- read.table(textConnection("
              reg         coef        se      myfactor
     (Intercept)  5.068608671 0.6990873 Labels
        goodTRUE  0.310575129 0.5228815 Labels
       indiaTRUE -1.196868662 0.5192330 Labels
       moneyTRUE -0.586451273 0.6011257 Labels
        maleTRUE -0.157618168 0.5332040 Labels
     (Intercept)  4.225580743 0.6010509  Bonus
        goodTRUE  1.272760149 0.4524954  Bonus
       indiaTRUE -0.829588862 0.4492838  Bonus
       moneyTRUE -0.003571476 0.5175601  Bonus
        maleTRUE  0.977011737 0.4602726  Bonus
    "),header=T)
    
    qplot(reg, coef, data = r.together, facets= .~myfactor ) + coord_flip() 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a faceted ggplot sorted by two discrete variables on
Trying to make a generic PL/SQL procedure to export data in specific XML format,
Trying to make a custom :confirm message for a rails form that returns data
im trying make one replace in string from a array but this dont work
I'm trying make some stuff in jQuery using ASP.NET. But the ID from runat=server
I'm trying make this code which is from a Dictionary of Arrays (CODE) from
I am trying to make a kind of 'faceted search' in ASP.NET and am
I am working with nHibernate, and trying make sense of bag collections. My data
I am trying make long screen to vertical direction. So, I need a screen
Trying to make a make generic select control that I can dynamically add elements

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.