转载Quandl R Package(一)
2017-10-10 12:10:10 】 浏览:6413次 本网站的内容取自网络,仅供学习参考之用,绝无侵犯任何人知识产权之意。如有侵犯请您及时与本人取得联系,万分感谢。
Tags:转载 Quandl Package

Quandl R Package Build Status

通过Quandl API可以快速准确地获取宏观经济数据。(




This is Quandl's R package. The Quandl R package uses the Quandl API. The official Quandl R package manual can be found here.

License provided by MIT.

For more information please contact


To install the devtools package:



To install the most recent package from CRAN type:


Note that the version on CRAN might not reflect the most recent changes made to this package.


To make full use of the package we recommend you set your api key. To do this create or sign into your account and go to your account api key page. Then input your API key (with quotes):



The Quandl package functions use the Quandl API. Optional Quandl API query parameters can be passed into each function. For more information on supported query parameters, please see the Quandl API documentation page. Once you find the data you would like to load into R on Quandl, copy the Quandl code from the description box and paste it into the function.

data <- Quandl("NSE/OIL")

Graphing Data Example

To create a graph of Google's performance month-over-month:


Note: collapse is a Quandl API query parameter. Click here for a full list of query parameter options.

Return Types

The supported return types for the Quandl(code) function are:

To request a specific type, assign the type argument the return type:

data <- Quandl('NSE/OIL', type = "xts")

Date Formats

zoo, xts, and ts have their own time series date formats. For example:

data <- Quandl('NSE/OIL', collapse = "quarterly", type = "zoo", limit = 3)

data will have indexes 2015 Q1, 2015 Q2, and 2015 Q3:

         Open  High    Low   Last  Close Total Trade Quantity Turnover (Lacs)
2015 Q1 459.8 462.8 452.45 454.45 454.95               277225         1265.84
2015 Q2 448.0 451.7 445.10 447.80 446.80               352514         1576.93
2015 Q3 456.0 465.0 454.15 456.80 456.75               174154          797.79

If you want the time series index to be displayed as dates, you will need to set force_irregular = TRUE:

data <- Quandl('NSE/OIL', collapse = "quarterly", type = "zoo", limit = 3, force_irregular = TRUE)

data will now have indexes 2015-03-31, 2015-06-30, and 2015-09-30:

            Open  High    Low   Last  Close Total Trade Quantity Turnover (Lacs)
2015-03-31 459.8 462.8 452.45 454.45 454.95               277225         1265.84
2015-06-30 448.0 451.7 445.10 447.80 446.80               352514         1576.93
2015-09-30 456.0 465.0 454.15 456.80 456.75               174154          797.79

Merged Dataset Data

If you want to get multiple codes at once, delimit the codes with ',', and put them into an array. This will return a multiset.

merged_data <- Quandl(c('GOOG/NASDAQ_AAPL', 'GOOG/NASDAQ_MSFT'))

You can also specify specific columns to retrieve. For example, if you only want column 1 from GOOG/NASDAQ_AAPL and column 2 from GOOG/NASDAQ_MSFT:

merged_data <- Quandl(c('GOOG/NASDAQ_AAPL.1', 'GOOG/NASDAQ_MSFT.2'))

Downloading Entire Database

An entire database's data can be download


转载Quandl R Package(一)

首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇R语言和机器学习---重要网站分享 下一篇R语言-基础解析


验 证 码:
表  情:
内  容: