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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:43:45+00:00 2026-06-13T02:43:45+00:00

I know it is a very silly question but I could not sort it

  • 0

I know it is a very silly question but I could not sort it out that is why asking…
How can I extract the rows from a large data set by common IDs and take the means of these rows and make a column having these IDs as rownames.
e.g.

IDs Var2    
Ae4 2       
Ae4 4
Ae4 6
Bc3 3   
Bc3 5   
Ad2 8
Ad2 7

OutPut
Var(x)
Ae4 4
Bc3 4
Ad2 7.5
  • 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-13T02:43:46+00:00Added an answer on June 13, 2026 at 2:43 am

    This kinds of things can easily be done using the plyr function ddply:

    dat = data.frame(ID = rep(LETTERS[1:5], each = 20), value = runif(100))
    > head(dat)
      ID      value
    1  A 0.45800889
    2  A 0.11221072
    3  A 0.58833532
    4  A 0.70056704
    5  A 0.08337996
    6  A 0.05195357
    
    ddply(dat, .(ID), summarize, mn = mean(value))
      ID        mn
    1  A 0.4960083
    2  B 0.5809681
    3  C 0.4512388
    4  D 0.5079790
    5  E 0.5397708
    

    If your dataset is big, and/or the number of unique ID‘s is big, you could use data.table. See this paper for more detail about plyr.

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

Sidebar

Related Questions

I know that this is a very silly question but I cannot work out
I know that this is very basic and silly question, but as I am
I know this very silly, but can anybody help me in understanding what does
I know this is a very silly question. Yet, am not able to find
I know this is very silly question. But, I'm very eager to know how
This is probably a very obvious question but I can't quite figure it out.
Ok yes it is a very silly question, but just that I am getting
I know very little about OOP, so maybe my question is silly, but still....
This sounds like a (very) silly question but I just can't find a way
Okay, this is (probably) a very simple question, but I am afraid I know

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.