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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:59:06+00:00 2026-06-11T10:59:06+00:00

At some point in my code, I get a list of tables that looks

  • 0

At some point in my code, I get a list of tables that looks much like this:

[[1]]
     cluster_size start end number       p_value
13             2    12  13    131 4.209645e-233
12             1    12  12    100 6.166824e-185
22            11    12  22    132 6.916323e-143
23            12    12  23    133 1.176194e-139
13             1    13  13     31  3.464284e-38
13            68    13 117     34  3.275941e-37
23            78    23 117      2  4.503111e-32

….

[[2]]
      cluster_size start end number       p_value
13             2    12  13    131 4.209645e-233
12             1    12  12    100 6.166824e-185
22            11    12  22    132 6.916323e-143
23            12    12  23    133 1.176194e-139
13             1    13  13     31  3.464284e-38

….

While I don’t show the full table here I know they are all the same size. What I want to do is make one table where I add up the p-values. Problem is that the $cluster_size, start, $end and $number columns don’t necessarily correspond to the same row when I look at the table in different list elements so I can’t just do a simple sum.

The brute force way to do this is to: 1) make a blank table 2) copy in the appropriate $cluster_size, $start, $end, $number columns from the first table and pull the correct p-values using a which() statement from all the tables. Is there a more clever way of doing this? Or is this pretty much it?

Edit: I was asked for a dput file of the data. It’s located here:
http://alrig.com/code/

In the sample case, the order of the rows happen to match. That will not always be the case.

  • 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-11T10:59:08+00:00Added an answer on June 11, 2026 at 10:59 am

    Seems like you can do this in two steps

    1. Convert your list to a data.frame
    2. Use any of the split-apply-combine approaches to summarize.

    Assuming your data was named X, here’s what you could do:

    library(plyr)
    #need to convert to data.frame since all of your list objects are of class matrix
    XDF <- as.data.frame(do.call("rbind", X))
    ddply(XDF, .(cluster_size, start, end, number), summarize, sump = sum(p_value))
    #-----
       cluster_size start end number          sump
    1             1    12  12    100 5.550142e-184
    2             1    13  13     31  3.117856e-37
    3             1    22  22      1  9.000000e+00
    ...
    29          105    23 117      2  6.271469e-16
    30          106    22 146     13  7.266746e-25
    31          107    23 146     12  1.382328e-25
    

    Lots of other aggregation techniques are covered here. I’d look at data.table package if your data is large.

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

Sidebar

Related Questions

I have some JSON data that looks like this: { data: [{ name:John Smith,
If some one can point me in the right direction for this code for
Im running into this error that I can't work out Im writing some code
I have data in my database that looks like this: Date (DateTime) Type (varchar)
I am working with some legacy code, and at some point there is a
Possible Duplicate: Calculate age in JavaScript In some point of my JS code I
Can anyone point me towards some good documentation / code examples on how best
The following code snippet generates some warning messages when compiling: Cluster& Myclass::getCluster(const Point &p)
Today I was tracking down a floating point exception in some code I had
So far I have managed to write some code that should print the source

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.