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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:20:36+00:00 2026-05-17T21:20:36+00:00

I have two tables. Both are read using the read.table() function. Table 1 A

  • 0

I have two tables. Both are read using the read.table() function.

Table 1

    A    B    C
S1  1    1    0
S2  2    0    NA
S3  0    2    1

Table 2

    Pa    Pb    Pc
G1  0.12  0.65  0.001
G2  0.34  0.82  0.03
G3  0.2   0.64  0.87

I need to iterate over both tables. Specifically, I need to iterate over table one column-wise and extract pairwise combinations for each of the entries in a particular column.

For example,

From the first column in table 1, I need to extract the values of all pairwise permutations of the elements in column 1, i.e., {1, 2}, {1, 0},{2, 0}, {2, 1}, {0, 1}, {0, 2}.

Using these values, and an element in Table 2 (this example, element [0, 1]), I will fit to a first order linear regression model.

Does anyone have any suggestions how best to iterate over table one to isolate all those pairwise permutations?

  • 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-17T21:20:37+00:00Added an answer on May 17, 2026 at 9:20 pm

    For getting the combinations by column in the first table, you can do this:

    apply(matrix(1:20, ncol=5), 2, combn, m=2)
    

    It will depend on how you want the final data to look. It might be more sensible as a list:

    apply(matrix(1:20, ncol=5), 2, function(x) list(combn(x, m=2)))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables, both with start time and end time fields. I need
I have a database with two tables ( Table1 and Table2 ). They both
I have two tables, Book and Tag , and books are tagged using the
I have two tables, one that contains volunteers, and one that contains venues. Volunteers
I have two tables: Table 1: ID, PersonCode, Name, Table 2: ID, Table1ID, Location,
I have two tables here - one is in UTF and holds Arabic text
I have two mysql tables which both have a typeID in common. I am
I have two tables with similar columns. I would simply like to select both
I have two tables from two different databases. For example: Table: Articles1 - Database:
I have two tables that are joined together. A has many B Normally you

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.