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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:49:05+00:00 2026-06-08T21:49:05+00:00

I am trying to summarize data based on month. For example, I have this

  • 0

I am trying to summarize data based on month. For example, I have this data set:

x
        Date App Vol
1 2010-01-30   A 100
2 2010-01-28   B 140
3 2010-01-30   C 160
4 2010-02-28   A 110
5 2010-02-28   B 120
6 2010-02-28   C 300

I would like to be able to summary App data by each month. According to the data frame above,
A should be 210, B = 260, C=460 etc.

I am using aggregate function ase below, but getting errors:

y<-aggregate(x$Vol, list(Month = format(as.POSIXct(x$Date), "%Y-%m")), sum)

any ideas?

  • 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-08T21:49:07+00:00Added an answer on June 8, 2026 at 9:49 pm

    Start with turning Vol into numeric (it got messed up somehow):

    x$Vol <- as.numeric(as.character(x$Vol))
    

    I can reproduce your eror by turning Vol into a factor as seen here:

    x$Vol <- as.factor(x$Vol)
    aggregate(x$Vol, list(x$App), sum)
    
    #> aggregate(x$Vol, list(x$App), sum)
    #Error in Summary.factor(1:2, na.rm = FALSE) : 
    #  sum not meaningful for factors
    

    Also you say:

    I would like to be able to summary App data by each month. According to the 
    data frame above, A should be 210, B = 260, C=460 etc.
    

    If this is the case use:

    x$Month <-  format(as.POSIXct(x$Date), "%Y-%m")
    aggregate(x$Vol, list(x$Month, x$App), sum)
    

    Otherwise use ttmacer’s suggestion.

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

Sidebar

Related Questions

Trying to make this jQuery filter that uses .find case-insensitive. For example, when the
trying to figure out why this is happening - I have an input text
so I have a data set with the following columns: test_group, person_id, gross, purchases.
I am trying to write a loop that will summarize my set of matrices
I'm trying to summarize data from several Google spreadsheet' sheets in a single one
Given a table of input data I would like to have a set o
Trying to figure out how I can do this properly. The print_r looks like
I'm trying to pass an array of ( varchar ) data into an Oracle
I am really trying to follow the DRY principle. I have a sub that
I'm trying to write a small Powershell function that will return some summary data

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.