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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:33:02+00:00 2026-06-02T12:33:02+00:00

I have a somewhat dumb R question. If I have a matrix (or dataframe,

  • 0

I have a somewhat dumb R question. If I have a matrix (or dataframe, whichever is easier to work with) like:

Year  Match
2008   1808
2008 137088
2008      1
2008  56846
2007   2704
2007 169876
2007  75750
2006   2639
2006 193990
2006      2

And I wanted to sum each of the match counts for the years (so, e.g. the 2008 row would be 2008 195743, how would I go about doing this? I’ve got a few solutions in my head but they are all needlessly complicated and R tends to have some much easier solution tucked away somewhere.

You can generate the same matrix above with:

structure(c(2008L, 2008L, 2008L, 2008L, 2007L, 2007L, 2007L, 
2006L, 2006L, 2006L, 1808L, 137088L, 1L, 56846L, 2704L, 169876L, 
75750L, 2639L, 193990L, 2L), .Dim = c(10L, 2L), .Dimnames = list(
NULL, c("Year", "Match")))

Thanks for any help you can offer.

  • 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-02T12:33:03+00:00Added an answer on June 2, 2026 at 12:33 pm

    aggregate(x = df$Match, by = list(df$Year), FUN = sum), assuming df is your data frame above.

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

Sidebar

Related Questions

I am somewhat new to LINQ and have a quick question regarding deleting. Say,
I have a question which may be somewhat silly because I'm pretty sure I
I have a MySQL table structured somewhat like this: type name value ===================== 1
I have an app that behaves somewhat like a photo gallery. They choose an
I have a somewhat hack-ish question and I'm intrigued as to how I would
I have somewhat of a strange question that is not really technical, but I
I have a somewhat complicated question related to MySQL. This is the table I
I have somewhat deep Json structure like below incoming over the wire into C#
I have somewhat of a thought question regarding jQuery Ajax. My question is this:
I have a somewhat ridiculous question regarding DDD, Repository Patterns and ORM. In this

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.