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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:55:42+00:00 2026-06-14T05:55:42+00:00

If I try to get endpoints for every year, for example, and do the

  • 0

If I try to get endpoints for every year, for example, and do the following:

xts.data <- xts(1:10000, order.by=seq(from=as.Date("1970-01-01"), by=1, len=10000))
z <- endpoints(xts.data, on="months", k=12)

The return value for this is:

> z
[1]     0 10000

Same with numbers higher than 12. Why would xts simply not return indices of every year or 13th month starting from the beginning. Is it limited by the number of periods in a year? That is if i did:

 z <- endpoints(xts.data, on="weeks", k=54)

This seems to work fine.

  • 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-14T05:55:43+00:00Added an answer on June 14, 2026 at 5:55 am

    Yes. This looks like something of an implementation gotcha. I’ll add a fix to R-forge once I can test the version I am working on more completely.

    UPDATED twice

    There is now a patch on this in rev 742 on R-forge. It isn’t likely final, but ideally this is the direction.

    > head(xts.data[z])
           [,1]
    1970-12-31  365
    1971-12-31  730
    1972-12-31 1096
    1973-12-31 1461
    1974-12-31 1826
    1975-12-31 2191
    
    > head(xts.data[endpoints(xts.data, on="months", k=1)])
               [,1]
    1970-01-31   31
    1970-02-28   59
    1970-03-31   90
    1970-04-30  120
    1970-05-31  151
    1970-06-30  181
    > head(xts.data[endpoints(xts.data, on="months", k=2)])
               [,1]
    1970-02-28   59
    1970-04-30  120
    1970-06-30  181
    1970-08-31  243
    1970-10-31  304
    1970-12-31  365
    > head(xts.data[endpoints(xts.data, on="months", k=3)])
               [,1]
    1970-03-31   90
    1970-06-30  181
    1970-09-30  273
    1970-12-31  365
    1971-03-31  455
    1971-06-30  546
    > head(xts.data[endpoints(xts.data, on="months", k=4)])
               [,1]
    1970-04-30  120
    1970-08-31  243
    1970-12-31  365
    1971-04-30  485
    1971-08-31  608
    1971-12-31  730
    > head(xts.data[endpoints(xts.data, on="months", k=6)])
               [,1]
    1970-06-30  181
    1970-12-31  365
    1971-06-30  546
    1971-12-31  730
    1972-06-30  912
    1972-12-31 1096
    > head(xts.data[endpoints(xts.data, on="months", k=7)])
               [,1]
    1970-07-31  212
    1971-02-28  424
    1971-09-30  638
    1972-04-30  851
    1972-11-30 1065
    1973-06-30 1277
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to get the main window handle using following code in Lazarus (Free
I try to get to a page straight from Bash at http://www.ocwconsortium.org/ . The
I try to get the last modification date of a file: NSFileManager *fm =
I try to get this following url using the downloadURL function as follows: http://www.ncbi.nlm.nih.gov/nuccore/27884304
I just try to post data to google by using the following code,but always
i try to get some data via WCF. İ created below app.config. But i
I try get a my attribute inside Fancybox, and I get when I use
i try to get my FragmentPagerAdapter working, but the examples are a bit to
I try to get the whole content between an opening xml tag and it's
I try to get some website attribute (colour of the cell) and compare in

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.