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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:03:20+00:00 2026-06-15T10:03:20+00:00

I have data arranged as below. My groups are in columns, I have two

  • 0

I have data arranged as below. My groups are in columns, I have two groups illustrated below. My actual data set contains about 15 paired variables.

How can I manipulate this data (an imported csv) in R so that I can compare the two groups? For example if I wanted to make a bargraph (using the sciplot library) bargraph.CI (var_x, group, data=mydata), how can I get these columns to be used as groups?

Time var_x var_y var_x_2 var_y_2 var_z var_z_2 
10:00 2 5 .33 .36 1.1 1.5
10:01 2 6 .34 .35 1.2 1.4
etc
  • 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-15T10:03:21+00:00Added an answer on June 15, 2026 at 10:03 am

    Here’s an answer using reshape in base, though I am sure there are a multitude of ways to tackle this issue.

    Firstly, recreate the test data:

    test <- read.table(header=TRUE,textConnection("Time var_x var_y var_x_2 var_y_2 var_z var_z_2 
    10:00 2 5 .33 .36 1.1 1.5
    10:01 2 6 .34 .35 1.2 1.4"))
    
    > test
       Time var_x var_y var_x_2 var_y_2 var_z var_z_2
    1 10:00     2     5    0.33    0.36   1.1     1.5
    2 10:01     2     6    0.34    0.35   1.2     1.4
    

    Reshape the data and save to a new data.frame

    testreshape <- reshape(test,
                       idvar="Time",
                       varying=list(c("var_x","var_x_2"),
                                    c("var_y","var_y_2"),
                                    c("var_z","var_z_2")),
                       v.names=c("var_x",  "var_y", "var_z"),
                       direction="long")
    > testreshape
             Time time var_x var_y var_z
    10:00.1 10:00    1  2.00  5.00   1.1
    10:01.1 10:01    1  2.00  6.00   1.2
    10:00.2 10:00    2  0.33  0.36   1.5
    10:01.2 10:01    2  0.34  0.35   1.4
    

    Run the barplot code:

    library(sciplot)
    bargraph.CI(var_x, time, data=testreshape)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a tab-delimited text file that contains data arranged in columns
I have about 20 data flow tasks arranged into a group in my control
I have a huge set data records in disk that arranged in sorted order
I have data coming from an external system (in CSV form). The data contains
I have data stored in three columns of Excel Column A: Serial Number Column
I have data from two different sources that I need to combine. Some data
I have data with no relation. Just need to count various columns from 3
I have a large number of entries arranged in three columns. Sample of the
I have data samples arranged in a 1000 x 56 array, and I would
A text file holds information about a softball team. Each line has data arranged

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.