【问题标题】:How to install Olson database?如何安装奥尔森数据库?
【发布时间】:2017-10-05 16:11:39
【问题描述】:

尝试使用 read_csv 函数读取 csv:

library(readr)
read_csv("myfile.csv")

返回警告:

Warning message in OlsonNames():
“no Olson database found”

然后错误:

Error: Unknown TZ UTC
Traceback:

1. read_csv("myfile.csv")
2. read_delimited(file, tokenizer, col_names = col_names, col_types = col_types, 
 .     locale = locale, skip = skip, comment = comment, n_max = n_max, 
 .     guess_max = guess_max, progress = progress)
3. col_spec_standardise(data, skip = skip, comment = comment, guess_max = guess_max, 
 .     col_names = col_names, col_types = col_types, tokenizer = tokenizer, 
 .     locale = locale)
4. guess_header(ds_header, tokenizer, locale)
5. guess_header_(datasource, tokenizer, locale)
6. default_locale()
7. locale()
8. check_tz(tz)
9. stop("Unknown TZ ", x, call. = FALSE)

在 R studio 中未返回时,我没有收到此错误,因此假设 Olson 数据库已预先安装在 R studio 中?

我如何在 R Jupyter notebook 上安装 Olson 数据库,以使 read_csv 按预期运行?

更新:

我在 Jupyter 笔记本上独立使用 OlsonNames() 调用时收到相同的错误。我正在运行的 Jupyter 笔记本是在 https://github.com/jupyter/docker-stacks/tree/master/r-notebook 指定的容器

更新 2:

docker 文件指定的 R 包:

# R packages
RUN conda install --quiet --yes \
    'r-base=3.3.2' \
    'r-irkernel=0.7*' \
    'r-plyr=1.8*' \
    'r-devtools=1.12*' \
    'r-tidyverse=1.0*' \
    'r-shiny=0.14*' \
    'r-rmarkdown=1.2*' \
    'r-forecast=7.3*' \
    'r-rsqlite=1.1*' \
    'r-reshape2=1.4*' \
    'r-nycflights13=0.2*' \
    'r-caret=6.0*' \
    'r-rcurl=1.95*' \
    'r-crayon=1.3*' \
    'r-randomforest=4.6*' && \
    conda clean -tipsy && \
    fix-permissions $CONDA_DIR

操作系统:Ubuntu Core 14.04

R 版本:

jovyan@6cf5af1246ff:~$ R -- version
WARNING: unknown option '--'

ARGUMENT 'version' __ignored__


R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[Previously saved workspace restored]

>

【问题讨论】:

  • 当你简单地运行OlsonNames()时你会得到这个吗?这是一个基本的 R 函数,如果失败,则与 readr 或 RStudio 无关(除非 RStudio 破坏了 R 设置......)
  • @Spacedman 请查看更新,看来我需要更新这个 Jupyter 笔记本所基于的 docker 容器。
  • OlsonNexecutinames() 来自哪里?此外,请提供 R、操作系统和软件包的版本。
  • @Spacedman 道歉,OlsonNexecutinames() 应该是 OlsonNames(),请参阅问题更新 2。

标签: r docker rstudio jupyter


【解决方案1】:

OlsonNames 函数非常简单。在 3.3.2 中,它会在这些位置查找时区名称:

     tzdirs <- c(Sys.getenv("TZDIR"), file.path(R.home("share"), 
        "zoneinfo"), "/usr/share/zoneinfo", "/usr/share/lib/zoneinfo", 
        "/usr/lib/zoneinfo", "/usr/local/etc/zoneinfo", "/etc/zoneinfo", 
        "/usr/etc/zoneinfo")

您需要确保列出的目录之一可用。如果您的系统上没有硬编码的,请将TZDIR 设置为指向一个副本。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-02-12
    • 2016-06-23
    • 2012-10-23
    • 1970-01-01
    • 2018-05-22
    • 2017-01-11
    • 2012-08-24
    • 1970-01-01
    相关资源
    最近更新 更多