locale() Error in match(x-6ren">
gpt4 book ai didi

r - 将 read_csv 与 readr 包一起使用时找不到函数 "OlsonNames"

转载 作者:行者123 更新时间:2023-12-02 02:45:32 26 4
gpt4 key购买 nike

我正在尝试使用 R 的 read_csv() 读取 csv 文件。

library(readr)
data <- read_csv("data/tmp.csv")

下面给出了 tmp.csv。

"A", "B", "C", "D", "E", "F", "G", "H", "I"
1,5,2015-07-31,5263,555,1,1,"0","1"
2,5,2015-07-31,6064,625,1,1,"0","1"
3,5,2015-07-31,8314,821,1,1,"0","1"
4,5,2015-07-31,13995,1498,1,1,"0","1"
5,5,2015-07-31,4822,559,1,1,"0","1"
6,5,2015-07-31,5651,589,1,1,"0","1"
7,5,2015-07-31,15344,1414,1,1,"0","1"
8,5,2015-07-31,8492,833,1,1,"0","1"
9,5,2015-07-31,8565,687,1,1,"0","1"

但它会产生以下错误。

Error in match(x, table, nomatch = 0L) : 
could not find function "OlsonNames"

如何解决这个错误?我已经使用该错误进行了谷歌搜索,但没有找到任何相关的解决方案。

<小时/>

经过一番挖掘后,出现了同样的错误:

> locale()
Error in match(x, table, nomatch = 0L) :
could not find function "OlsonNames"

这似乎是与https://stat.ethz.ch/R-manual/R-devel/library/base/html/timezones.html相关的错误

重新启动 R session 不起作用。

我应该如何解决该错误?我需要安装一些软件包吗?如果有,是哪一个?

最佳答案

更新 R 似乎可以解决该问题。

要更新到 Ubuntu 14.04 的 R 3.2.2(仅适用于 Ubuntu 14.04 Trusty,如果您不使用 14.04,请正确更新 deb 软件包):

sudo echo 'deb http://cran.es.r-project.org/bin/linux/ubuntu trusty/' >> /etc/apt/sources.list
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade

(更新说明来自:http://ubuntuforums.org/showthread.php?t=2264580)然后在最新版本的 R 中:

> install.packages('readr')
> library(readr)
> locale()
<locale>
Numbers: 123,456.78
Formats: %Y%.%m%.%d / %H:%M
Timezone: UTC
Encoding: UTF-8
<date_names>
Days: Sunday (Sun), Monday (Mon), Tuesday (Tue), Wednesday (Wed), Thursday
(Thu), Friday (Fri), Saturday (Sat)
Months: January (Jan), February (Feb), March (Mar), April (Apr), May (May),
June (Jun), July (Jul), August (Aug), September (Sep), October
(Oct), November (Nov), December (Dec)
AM/PM: AM/PM

现在加载 read_csv 可以正常工作,不会出现 OlsonNames 错误。

<小时/>

在更新我的 R 之前,这是我的 R 版本:

> version
_
platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 3
minor 0.2
year 2013
month 09
day 25
svn rev 63987
language R
version.string R version 3.0.2 (2013-09-25)
nickname Frisbee Sailing

关于r - 将 read_csv 与 readr 包一起使用时找不到函数 "OlsonNames",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33414457/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com