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

  • Home
  • SEARCH
  • 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 8800863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:42:05+00:00 2026-06-14T00:42:05+00:00

I have a simple problem, honestly I have tried to find an answer. I

  • 0

I have a simple problem, honestly I have tried to find an answer. I really did.

I have a bunch of .csv files that have been imported into R data frames

I would like to take a specific column (with a common name) from each data frame, merge it into a single data frame with the name of the data frame as the column name, and produce a boxplot using each column.

The columns are not of the same length and frequently contain NA’s.

Example: Data frames (in which the first row is the header)

Data frame name Tom:

col1    col2 col3 col4
name1   33   44   55
name2   33   NA   55
name3   33   34   55
name4   33   24   55

Data frame name Bob:

col1    col2 col3 col4
name5   33   74   55
name6   33   NA   55
name7   33   32   55

Data frame name Stu:

col1    col2 col3 col4
name8   33   44   55
name9   33   11   55
name10  33   34   55
name11  33   24   55
name12  33   32   55
name13  33   24   5
name14  33   34   55
name15  33   24   5

Desired result

Tom  Bob  Stu
44   74   44
NA   NA   11 
34   32   34
24        24
          32
          24
          34
          24

So, taking “col3” (the column name is shared) from each data frame, and produce a new data frame of only the col3 data, each column to be named as the name of the data frame it came from…followed by producing a side-by-side boxplot of Tom, Bob and Stu (but I can probably work that out). It’s OK to have NA’s in the empty spaces in the desired result above.

  • 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-06-14T00:42:06+00:00Added an answer on June 14, 2026 at 12:42 am

    Here is a basic approach where I create a new combined data frame using rbind, after adding an identifier column to each of your 3 data frames. Note that you can also create a boxplot without first creating a single data frame.

    Tom = read.table(header=TRUE,
    text="col1    col2 col3 col4
    name1   33   44   55
    name2   33   NA   55
    name3   33   34   55
    name4   33   24   55")
    
    Bob = read.table(header=TRUE,
    text="col1    col2 col3 col4
    name5   33   74   55
    name6   33   NA   55
    name7   33   32   55")
    
    Stu = read.table(header=TRUE,
    text="col1    col2 col3 col4
    name8   33   44   55
    name9   33   11   55
    name10  33   34   55
    name11  33   24   55
    name12  33   32   55
    name13  33   24   5
    name14  33   34   55
    name15  33   24   5")
    
    # Add a new person identifier column to each data frame.
    Tom$person = "Tom"
    Bob$person = "Bob"
    Stu$person = "Stu"
    
    # Combine 3 data frames by row.
    dat = rbind(Tom, Bob, Stu)
    
    dat
    #      col1 col2 col3 col4 person
    # 1   name1   33   44   55    tom
    # 2   name2   33   NA   55    tom
    # 3   name3   33   34   55    tom
    # 4   name4   33   24   55    tom
    # 5   name5   33   74   55    bob
    # 6   name6   33   NA   55    bob
    # 7   name7   33   32   55    bob
    # 8   name8   33   44   55    stu
    # 9   name9   33   11   55    stu
    # 10 name10   33   34   55    stu
    # 11 name11   33   24   55    stu
    # 12 name12   33   32   55    stu
    # 13 name13   33   24    5    stu
    # 14 name14   33   34   55    stu
    # 15 name15   33   24    5    stu
    
    
    boxplot(col3 ~ person, data=dat)
    
    # This would also work, without rearranging the data:
    boxplot(Tom[, "col3"], Bob[, "col3"], Stu[, "col3"])
    
    # Save to pdf file.
    pdf("boxplot_1.pdf", height=5, width=5)
    boxplot(col3 ~ person, data=dat, main="Boxplot of three samples.", ylab="col3")
    dev.off()
    

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple problem that I have not been able to find an
I have a simple problem that I've been stuck on for some time and
I have a problem on a program I'm making that I honestly can't find
I have a simple problem that i cannot solve. I have a dictionary: aa
I have a simple problem that says: A password for xyz corporation is supposed
I have simple LINQ problem that I can't figure out. I have a table
I have really simple problem in my PHP script. There is a function defined
I have simple problem. I've a field in my content type (header image) that
i have very simple problem. I need to create model, that represent element of
I have a simple problem that reads an Excel file (using interop) and fills

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.