SNBdata
收藏资源简介:
从瑞士国家银行(SNB)下载数据集的功能包。该包轻量级,依赖少,仅在需要将数据转换为特定数据结构时使用建议的包。下载的数据可以被缓存以避免重复下载。
A utility package for downloading datasets from the Swiss National Bank (SNB). This lightweight package has minimal dependencies, and only leverages the recommended packages when converting downloaded data into specific data structures. Downloaded datasets can be cached to avoid redundant downloads.
SNBdata
SNBdata 是一个用于从瑞士国家银行(SNB; https://data.snb.ch)下载数据的工具包。该包轻量且依赖较少,推荐包仅在需要将数据转换为特定数据结构(如 zoo 对象)时使用。下载的数据可以选择缓存,以避免重复下载相同的文件。
功能
- 数据下载:支持从瑞士国家银行下载数据。
- 数据缓存:下载的数据可以选择缓存。
- 数据转换:可以将数据转换为时间序列格式。
示例
以下是一些使用 SNBdata 的示例:
-
设置存储目录: R data.dir <- tempdir()
-
下载数据: R rates <- fetch_data("rendoblim", type = "table", dest.dir = data.dir, language = "en")
-
将数据转换为时间序列: R rates <- fetch_data("rendoblim", type = "table", dest.dir = data.dir, language = "en", time.series = TRUE)
-
获取标识符/代码信息: R if (!is.null(rates)) ## 检查:如果下载失败,结果为 NULL attr(rates, "info")
-
另一个示例: R stock.markets <- fetch_data("capchstocki", type = "table", dest.dir = data.dir, time.series = TRUE)
例如:stock.markets[, "GDR"] ## 总回报指数




