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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:25:32+00:00 2026-06-16T17:25:32+00:00

I have a time series data, and I wanted to use a function to

  • 0

I have a time series data, and I wanted to use a function to return suitably lagged and iterated divided value.

Data:

ID   Temperature value
1   -1.1923333
2   -0.2123333
3   -0.593
4   -0.7393333
5   -0.731
6   -0.4976667
7   -0.773
8   -0.6843333
9   -0.371
10  0.754
11  1.798
12  3.023
13  3.8233333
14  4.2456667
15  4.599
16  5.078
17  4.9133333
18  3.5393333
19  2.0886667
20  1.8236667
21  1.2633333
22  0.6843333
23  0.7953333
24  0.6883333

The function should work like this:

new values : 23ID=value(24)/value(23), 22ID=value(23)/value(22), 21ID=value(22)/value(21), and so forth.

Expected Results:

ID  New Temperature value
1   0.17    
2   2.79    
3   1.24    
4   0.98    
5   0.68    
6   1.55    
7   0.885   
8   0.54    
9   -2.03   
10  2.38    
11  1.68    
12  1.264   
13  1.11    
14  1.083   
15  1.104   
16  0.967   
17  0.72    
18  0.59    
19  0.873   
20  0.69    
21  0.541   
22  1.16    
23  0.86    
24  NAN 
  • 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-16T17:25:34+00:00Added an answer on June 16, 2026 at 5:25 pm

    To divide each element of a vector x by its successor, use:

    x[-1] / x[-length(x)]
    

    This will return a vector with a length of length(x) - 1. If you really need the NaN value at the end, add it by hand via c(x[-1] / x[-length(x)], NaN).

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

Sidebar

Related Questions

I have two time series of data, one which is water temperature and the
I have a count time series data which I'm able to use to determine
I have to apply regression function progressively to a time series data (vector time
I have an irregular(?) time series data points in a day as following Jun
I have a data.frame of a time series of data, I would like to
I have a time series data where I want to perform aggregation on it
I have temporal database and I wanted to obtain hourly average for time series
I have a time series data that can plot using: plot(x$numbers, type=l, col=blue) I
I have some time-series data that I'm fitting a loess curve in ggplot2, as
I have two time series data frames: The first one: head(df1) : MSCI ACWI

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.