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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:47:02+00:00 2026-05-26T04:47:02+00:00

I have a big list, but micro example would be like the following: A

  • 0

I have a big list, but micro example would be like the following:

A <- c("A", "a", "A", "a", "A")
B <- c("A", "A", "a", "a", "a")
C <- c(1, 2, 3, 1, 4) 
mylist <- list(A=A, B=B, C= C)

expected output is merge A with B so that each component will look like AB

AA, aA, Aa, aa, Aa

better should be sorted, upper case is always first

AA, Aa, Aa, aa, Aa

Thus new list or matrix should have two columns or rows:

AA, Aa, Aa, aa, Aa
1,   2, 3,   1, 4

Now I want calculate average of C based on class – “AA”, “Aa”, and “aa”

Looks simple but I could not figure out easily.

  • 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-26T04:47:02+00:00Added an answer on May 26, 2026 at 4:47 am
    > (ab <- paste(A, B, sep="") )
    [1] "AA" "aA" "Aa" "aa" "Aa"
    > (ab <- paste(A, B, sep="") )  # the joining step
    [1] "AA" "aA" "Aa" "aa" "Aa"
    > (ab <- sub("([a-z])([A-Z])", "\\2\\1", ab) ) # swap lowercase uppercase
    [1] "AA" "Aa" "Aa" "aa" "Aa"
    
    > rbind(ab, C)                  # matrix
       [,1] [,2] [,3] [,4] [,5]
    ab "AA" "Aa" "Aa" "aa" "Aa"
    C  "1"  "2"  "3"  "1"  "4" 
    > data.frame(alleles=ab, count=C)  # dataframes are lists
      alleles count
    1      AA     1
    2      Aa     2
    3      Aa     3
    4      aa     1
    5      Aa     4
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a big list of global variables that each have their own setup
How would you maintain the legacy applications that: Has no unit tests have big
I have a big list of properties that I need to map between two
Passing messages around with actors is great. But I would like to have even
So basically I have a big list of buttons that's present dropdowns and other
I have a problem, where i have big list of number pairs. something like
I have a big item list that I wanted to hide, and then a
I have a big form, with many list boxes that are feeded by an
I have big URL list, which I have to download in parallel and check
I have big system that make my system crash hard. When I boot up,

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.