gpt4 book ai didi

r - 错误 'nzchar()' 需要字符向量 lubridate

转载 作者:行者123 更新时间:2023-12-02 04:55:13 25 4
gpt4 key购买 nike

我正在尝试从网页 https://r-forge.r-project.org/scm/viewvc.php/pkg/AppliedPredictiveModeling/inst/chapters/CreateGrantData.R?view=markup&revision=11&root=apm 运行代码.

当我在下面运行时出现错误

month info startTime <- dmy(raw$Start.date)

parse_date_time 错误(日期、订单、quiet = quiet、tz = tz、locale = locale、: 'nzchar()' 需要一个字符向量

来自上述网页的代码需要一些调整。必须在他的计算机上复制文件“unimelb_training.csv”。该文件位于 http://www.kaggle.com/c/unimelb/data

我已经联系了作者。他无法重现错误,因此无能为力。他建议我提供上述网页的链接,而不是复制粘贴整个代码。本书的网址是http://appliedpredictivemodeling.com/

请帮忙...谢谢

最佳答案

我给 lubridate 包的作者发了邮件。他的名字和回复如下:

加勒特·格罗蒙德

您的错误来 self 们正在处理的 lubridate 中的错误。解析函数目前无法处理因子。 raw$Start.date 是一个因素。您可以通过将 as.character() 放在 raw$Start.date 周围来使您的代码工作,例如

startTime <- dmy(as.character(raw$Start.date))

我会在下一个 lubridate 版本中修复这个问题。

干杯,加勒特

关于r - 错误 'nzchar()' 需要字符向量 lubridate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18110457/

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