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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:51:32+00:00 2026-06-18T03:51:32+00:00

I have a time series object in R with multiple vectors. I would like

  • 0

I have a time series object in R with multiple vectors. I would like to calculate the period-over-period percentage change at each point in time (save t = 1, which would obviously be NA) for each vector.

> data <- ts(data.frame(x1=c(1:10), x2=c(11:20), x3=c(21:30)), start = c(2010,3), frequency = 4)
> data
        x1 x2 x3
2010 Q3  1 11 21
2010 Q4  2 12 22
2011 Q1  3 13 23
2011 Q2  4 14 24
2011 Q3  5 15 25
2011 Q4  6 16 26
2012 Q1  7 17 27
2012 Q2  8 18 28
2012 Q3  9 19 29
2012 Q4 10 20 30
  • 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-18T03:51:34+00:00Added an answer on June 18, 2026 at 3:51 am

    Try this:

    R> data/stats::lag(data,-1) - 1
             data.x1   data.x2   data.x3
    2010 Q4 1.000000 0.0909091 0.0476190
    2011 Q1 0.500000 0.0833333 0.0454545
    2011 Q2 0.333333 0.0769231 0.0434783
    2011 Q3 0.250000 0.0714286 0.0416667
    2011 Q4 0.200000 0.0666667 0.0400000
    2012 Q1 0.166667 0.0625000 0.0384615
    2012 Q2 0.142857 0.0588235 0.0370370
    2012 Q3 0.125000 0.0555556 0.0357143
    2012 Q4 0.111111 0.0526316 0.0344828
    R> 
    
    • 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 of a time series of data, I would like to
I have a series of mostly identical images taken over a period of time.
I have a time series like this which consists of past 4 months (Feb,
I have various time-series I'd like to correlate and present as either a csv-file
I have a time series of two indexes, with each row representing the closing
I have a xts object (stock price time series) that is comprised of intraday
I have a list of vectors which are time series of inequal length. My
I have a zoo time series object, vels : 2011-05-01 00:00:00 7.52 2011-05-01 00:10:00
I have some XAML like this drawing a scatterplot of a time series (X-Axis:
I have a time series object grouped of the type <pandas.core.groupby.SeriesGroupBy object at 0x03F1A9F0>

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.