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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:11:49+00:00 2026-05-27T19:11:49+00:00

This should be exceptionally simple. I have a zoo object with 500 times series

  • 0

This should be exceptionally simple. I have a zoo object with 500 times series (each one a different product) and 250 periods of sales. The zoo object is perfectly rectangular, all series contain an observation at each point in time. My index column is a very simple 1…250,

My difficulty is in trying to aggregate all of the time series to form a “Total Sales” series.

I’ve tried using aggregate, which seems focused on aggregating rows e.g. days into months. But I want to keep every time period, just aggregate the time series together. This is a simplified version of my zoo object shown below with only 5 series.

head(z.all)

     1        2         3        4        5
 1 1232.205 1558.056  993.9784 1527.066 359.6946

 2 1262.194 1665.084 1092.0105 1834.313 484.5073

 3 1301.034 1528.607  900.4158 1587.548 525.5191

 4 1014.082 1352.090 1085.6376 1785.034 490.9164

 5 1452.149 1623.015 1197.3709 1944.189 600.5150

 6 1463.359 1205.948 1155.0340 1528.887 556.6371

When I try to aggregate using either of the following 2 commands I get exactly the same data as in my original zoo object!!

 aggregate(z.all[,1:num.series], index(z.all), sum)

 aggregate(z.all, index(z.all), sum)

However I am able to aggregate by doing this, though it’s not realistic for 500 columns! I want to avoid using a loop if possible.

 z.all[,1] + z.all[,2]

Apologies if this is not the right protocol, it’s my first post in this site.

  • 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-27T19:11:49+00:00Added an answer on May 27, 2026 at 7:11 pm

    I hope i understood correctly what you want. But if it is a rowsum you are looking for:

     rowSums(z.all)
    

    directly from the base package. (?rowSums). This function adds all values along one row:

    D<-cbind(rep(1,10),c(1:10))
     colSums(D)
      [1] 10 55
     rowSums(D)
      [1]  2  3  4  5  6  7  8  9 10 11 
    

    the opposite would be colSums() which would sum each column.

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

Sidebar

Related Questions

This should hopefully be a simple one. I would like to add an extension
This should be an easy one. I have a table like so: <table> <tr>
This should be really simple. If I have a String like this: ../Test?/sample*.txt then
This should be simple enough, but somehow my brain stopped working. I have two
This should be a really really simple thing, but for some reason it is
This should be straight forward for a guru. I don't have any code really
This should be a simple question, but I haven't been able to find a
This should be simple enough, and I blame this primarily on my inexperience working
This should be quite simple, although I was not able to find a solution
This should be really simple. I want to repeat a string in Ruby 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.