如何安装Olson数据库?

时间:2017-10-05 16:11:39

标签: r docker rstudio jupyter

尝试使用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笔记本上安装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

OS: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]

>

1 个答案:

答案 0 :(得分:1)

In[87]: df.dtypes Out[87]: fft object complex complex128 polar_x float64 polar_y float64 dtype: object 功能非常简单。在3.3.2中,它在这些位置查找时区名称:

OlsonNames

您需要确保列出的目录之一可用。如果系统中没有任何硬编码的设置,请将 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") 设置为指向副本。