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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:29:47+00:00 2026-05-14T05:29:47+00:00

I have a data.frame in R that looks like this: score rms template aln_id

  • 0

I have a data.frame in R that looks like this:

      score    rms  template   aln_id       description
1  -261.410  4.951 2f22A.pdb  2F22A_1 S_00001_0000002_0
2  -231.987 21.813 1wb9A.pdb  1WB9A_4 S_00002_0000002_0
3  -263.722  4.903 2f22A.pdb  2F22A_3 S_00003_0000002_0
4  -269.681 17.732 1wbbA.pdb  1WBBA_6 S_00004_0000002_0
5  -258.621 19.098 1rxqA.pdb  1RXQA_3 S_00005_0000002_0
6  -246.805  6.889 1rxqA.pdb 1RXQA_15 S_00006_0000002_0
7  -281.300 16.262 1wbdA.pdb 1WBDA_11 S_00007_0000002_0
8  -271.666  4.193 2f22A.pdb  2F22A_2 S_00008_0000002_0
9  -277.964 13.066 1wb9A.pdb  1WB9A_5 S_00009_0000002_0
10 -261.024 17.153 1yy9A.pdb  1YY9A_2 S_00001_0000003_0

I can calculate summary statistics on the data.frame like this:

> tapply( d$score, d$template, mean )
1rxqA.pdb 1wb9A.pdb 1wbbA.pdb 1wbdA.pdb 1yy9A.pdb 2f22A.pdb 
-252.7130 -254.9755 -269.6810 -281.3000 -261.0240 -265.5993 

Is there an easy way that I coerce this output back into a data.frame? I’d like for it to have these two columns:

d$template
mean

I love tapply, but right now I’m cutting and pasting the results from tapply into a text file and hacking it up a bit to get the summary statistics that I want with appropriate names. This feels very wrong, and I’d like to do something better!

  • 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-14T05:29:48+00:00Added an answer on May 14, 2026 at 5:29 am
    library(plyr)
    ddply(d, "template", summarise, mean = mean(score))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data.frame that looks like this: > head(ff.df) .id pio caremgmt prev
I have a data frame in R that looks like this: > TimeOffset, Source,
I have a data.frame that looks like this > head(df) Memory Memory Memory Memory
I have a data frame that looks like this: user1,product1,0 user1,product2,2 user1,product3,1 user1,product4,2 user2,product3,0
I have a ROC.Value data frame that looks like this: Years 1 2 3
I have a dataset that looks like this: a <- data.frame(rep(1,5),1:5,1:5) b <- data.frame(rep(2,5),1:5,1:5)
I have a data set that looks like this: ID | DATE | SCORE
I have a data.frame that looks like this. x a 1 x b 2
I have a semi-melted data frame that looks like this: head(final_melt) Group Source variable
I have a data frame that looks like this: type created_at repository_name 1 IssuesEvent

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.