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 7504263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:30:59+00:00 2026-05-29T21:30:59+00:00

I have a data frame with 30 columns numbered from 0 to 29. I

  • 0

I have a data frame with 30 columns numbered from 0 to 29.

I call stack on this data frame to plot a series of boxplots, one for each column number.
But instead of getting the boxplots in the sequence 0,1,2,3, … it prints 0,1,10,11..19, 2, 7, 8, 9.
In other words, i want the boxplots to appear in the same sequence of the columns, which
is natural.

I’m using boxplot(values ~ column, data = mydata).
I don’t want to fix that by changing the column names.
Is there another solution?

Thanks!

  • 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-29T21:31:01+00:00Added an answer on May 29, 2026 at 9:31 pm

    stack stores the column name as a factor,
    and the default order is alphabetic.
    You can either fix the order once it has been tampered with,
    or just use melt instead of stack:
    the column order will be preserved.

    # Sample data
    d <- matrix( rnorm(300), nc=30 )
    d <- as.data.frame( d )
    colnames(d) <- as.character(0:29)
    
    # Plot
    library(reshape2)
    boxplot( value ~ variable, melt(d) )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data.frame with 2 columns: Node A, Node B. Each entry in
I have a data frame with two columns. First column contains categories such as
I have a data frame where one particular column has a set of specific
I have a data.frame from this code: my_df = data.frame(read_time = c(2010-02-15, 2010-02-15, 2010-02-16,
I have a data frame containing multiple time series of returns, stored in columns.
I have a data frame with 22239 rows & 200 columns. The first column
I have a data frame with several columns, one of which is a factor
I have a data.frame with 2 columns dates=dates of observations for each station and
I have a data.frame which has multiple columns. One of the columns is time
I have a data frame where some of the columns contain NA values. How

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.