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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:10:52+00:00 2026-05-23T12:10:52+00:00

Considering the following List : answers = { {{1, 2}, {7, 3}}, {{1, 3},

  • 0

Considering the following List :

answers = {
          {{1, 2}, {7, 3}}, {{1, 3}, {6, 4}}, 
          {{2, 1}, {2, 8}}, {{2,3}, {8, 2}}, 
          {{3, 1}, {1, 9}}, {{3, 2}, {3, 7}}
          }

enter image description here

Within the context of a task where subjects are sequentially presented 2 stimuli, having to choose the one they prefer, the first sublist :

{{1, 2}, {7, 3}}

can be read as

{{Cond1,Cond2}, {Cond1 Preferred Count,Cond2 Preferred Count}}

So when choosing 10 times between Cond1 & Cond2 when Cond1 is presented first, Cond1 is preferred 7 times out of 10.

**

I need to conditionally extract and/or
sum part of the list.

**

What I have been doing thus far:

To extract lists where Cond1 is presented first :

Select[answers, #[[1, 1]] == 1 &]

= {{{1, 2}, {7, 3}}, {{1, 3}, {6, 4}}}

And to get the total of count for one condition against all others :

Plus @@ Select[answers, #[[1, 1]] == 1 &][[All, 2]]

={13, 7}

Now, I need to :

Query the total count for Cond1 VS Cond2 & Cond2 VS Cond1 :

{{{1, 2}, {7, 3}},{{2, 1}, {2, 8}}}

would be the output

or total of count when Cond2 was presented first against Cond3 :

{{2,3}, {8, 2}}

Those are what I am missing.
There are 5 conditions total in reality

  • 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-23T12:10:52+00:00Added an answer on May 23, 2026 at 12:10 pm

    I like Cases for this, since I think the syntax comes out cleaner. Here’s one approach, using a couple of light utility functions:

    In[25]:= conditions[pat_] := Cases[answers, {pat, _}]
    
    In[26]:= conditionSums[pat_] := Total[Last /@ conditions[pat]]
    
    In[27]:= conditions[{1, _}]
    
    Out[27]= {{{1, 2}, {7, 3}}, {{1, 3}, {6, 4}}}
    
    In[28]:= conditionSums[{1, _}]
    
    Out[28]= {13, 7}
    
    In[29]:= conditions[{1, 2} | {2, 1}]
    
    Out[29]= {{{1, 2}, {7, 3}}, {{2, 1}, {2, 8}}}
    
    In[30]:= conditions[{2, 3}]
    
    Out[30]= {{{2, 3}, {8, 2}}}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay considering having the following sample string. Duis posuere suscipit lacus quis lacinia. In
Considering following code public class A { public static void main(String[] args) { new
Considering the following table: someId INTEGER #PK ageStart TINYINT(3) ageEnd TINYINT(3) dateBegin INTEGER dateEnd
considering the following enum: public enum LeadStatus { Cold = 1, Warm = 2,
Considering this article Developing a MVC component for Joomla , following is the code
considering this example: public static void main(final String[] args) { final List<String> myList =
Considering the following data frames : > tail(tot.final) names.id sequence names.reads width.reads names.counts st
Considering the following vector: [1] 1-1694429 2-1546669 3-928598 4-834486 5-802353 6-659439 7-552850 8-516804 9-364061
Considering the following database : Post -> User The entities : class User {
Considering the following sample XAML file, which shows the first 1000 people of Facebook,

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.