quandl / quandl-r

This is Quandl's R Package
https://cran.r-project.org/web/packages/Quandl/
Other
139 stars 55 forks source link

Monthly aggregation of more granular data results in non-continuous time index #26

Closed ProbStub closed 9 years ago

ProbStub commented 9 years ago

When pulling data that is more granular than monthly data but the request is to collapse to monthly data the time index of resulting time series is confused. Demonstration below.

waso <-Quandl(c(paste("SEC/ADBE_WEIGHTEDAVERAGENUMBEROFDILUTEDSHARESOUTSTANDING_Q",sep="")), collapse="monthly", type="zoo", start_date = "2007-01-03", end_date = "2014-10-31",authcode = "") index(waso)

I would have expected that months that do hold actual data are part of the time series, albite show "NA" values instead. This may be an issue with the API or with the R access package. A workaround could be merging with a continuous time series, shown below.

cbind.zoo(waso,zoo(rep(1,93),yearmon(2007+seq(0,93)/12)),fill=NA)

dmpe commented 9 years ago

@ProbStub hmm, well, I see your point. On the other hand, I think the proposed ("what you expect") solution would be not desirable to the rest of users because data are only available from 05/2009 until 08/2014 which usually users want to see.

This is also returns json API even though you start in 2007

https://www.quandl.com/api/v1/datasets/SEC/ADBE_WEIGHTEDAVERAGENUMBEROFDILUTEDSHARESOUTSTANDING_Q.json?auth_token=GgnxpyUBXHsyQxqp67bY&collapse=monthly&trim_start=2007-05-28

Your workaround is working well, so from my side I would not consider this an issue (i.e. wontfix).

Also, from my side, sorry for the late reply.