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

The Archive Base Latest Questions

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

…either spline- (best) or linear-interpolated (OK) or just repeated values (fine) throughout the quarter.

  • 0

…either spline- (best) or linear-interpolated (OK) or just repeated values (fine) throughout the quarter. The issue is that I do not know how to convert the data type returned by getFin() and viewFin() into something timeSeries-type usable. Here is my code:

getFin('F')
x <- viewFin(F.f, "BS", period="Q")["Total Common Shares Outstanding",]*1000

My desired output is

> x
GMT     x.ts
2011-09-01  3816000
2011-08-01  3816000
2011-07-01  3816000
2011-06-01  3815000
2011-05-01  3815000
2011-04-01  3815000
2011-03-01  3813000
2011-02-01  3813000
2011-01-01  3813000
2010-12-01  3778000
2010-11-01  3778000
2010-10-01  3778000
2010-09-01  3484000

However, here is some actual output:

> x
2011-09-30 2011-06-30 2011-03-31 2010-12-31 2010-09-30 
   3816000    3815000    3813000    3778000    3484000 
> str(x)
 Named num [1:5] 3816000 3815000 3813000 3778000 3484000
 - attr(*, "names")= chr [1:5] "2011-09-30" "2011-06-30" "2011-03-31" "2010-12-31" ...

It looks like the x object is in some strange reverse format, where the key is the numeric value, and the value is a character string of the date. When I try to extract dates, or the numeric component, I cannot isolate the numeric portion to generate a time series object.

Ideally, to get to my desired output, I would be able to say

mydates <- timeSequence(from = "2011-01-01", to=Sys.Date(), by = "month")
series <- timeSeries(x$data, mydates)

But I can’t seem to extract the numeric data portion.

UPDATE

From here and here, I adapted the following code:

getFin('F')
x <- viewFin(F.f, "BS", period="Q")["Total Common Shares Outstanding",]*1000
zoox = zoo(x, order.by=as.Date(names(x)))
x2 <- na.spline(merge(zoox, foo=zoo(NA, order.by=seq(start(zoox), end(zoox), "month")))[, 1])

However, my output mangles the dates a bit and messes up the interpolation:

>x2
2010-09-30 2010-10-30 2010-11-30 2010-12-30 2010-12-31 2011-01-30 2011-03-02 
   3484000    3623591    3720509    3776671    3778000    3804738    3813071 
2011-03-30 2011-03-31 2011-04-30 2011-05-30 2011-06-30 2011-07-30 2011-08-30 
   3813025    3813000    3813100    3814116    3815000    3814976    3814884 
2011-09-30 
   3816000 

As you can see, I have both 12-30 and 12-31, 3 values for March-2011, but no February, etc. How to solve this?

  • 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-27T00:49:18+00:00Added an answer on May 27, 2026 at 12:49 am

    UPDATE 2:

    Please post a better answer! This is really ugly, but here’s how I got something acceptable:

    getFin('F')
    x <- viewFin(F.f, "BS", period="Q")["Total Common Shares Outstanding",]*1000
    zoox = zoo(x, order.by=as.Date(names(x)))
    foo=zoo(NA, order.by=seq(as.Date(as.character(timeFirstDayInMonth(start(zoox)))), as.Date(as.character(timeFirstDayInMonth(end(zoox)))), "month"))
    foo2 <- na.approx(merge(zoox, foo)[, 1])
    fx <- merge(foo2,foo, all=FALSE)[,1]
    

    Which converts

    > x
    2011-09-30 2011-06-30 2011-03-31 2010-12-31 2010-09-30 
       3816000    3815000    3813000    3778000    3484000 
    

    into

    > fx
    2010-10-01 2010-11-01 2010-12-01 2011-01-01 2011-02-01 2011-03-01 2011-04-01 
       3487196    3586261    3682130    3778389    3790444    3801333    3813022 
    2011-05-01 2011-06-01 2011-07-01 2011-08-01 2011-09-01 
       3813681    3814363    3815011    3815348    3815685 
    

    I find this too ugly to be true, so I post this answer, but want someone else to post a handsomer one.

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

Sidebar

Related Questions

so I did $subject = 'sakdlfjsalfdjslfad <a href=something/8230>lol is that true?</a> lalalala'; $subject =
CGI.escapeHTML is pretty bad, but CGI.unescapeHTML is completely borked. For example: require 'cgi' CGI.unescapeHTML('&#8230;')
I have an element like this: <span class=tool_tip title=The full title>The ful&#8230;</span> This seems
English is not my native language. I need a software to spellcheck and correct
(tl;dr: see summary at the bottom.) I am implementing an application that pulls content
I see that some rss on xml have strange strings. For example, ... is
When I use the list function: el_nino_1974_2000_all <- list() for (k in seq_along(el_nino_start_month)){ el_nino_1974_2000_all[[k]]
what about this one: I want to format the currentTime displayed by a videoPlayer
I want to sign a message according to the RSA-SHA1 Signature Method in OAuth
I have been making a wordpress template. i got stuck at some place... the

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.