gpt4 book ai didi

r - R CMD 检查中的意外符号库

转载 作者:行者123 更新时间:2023-12-04 14:22:24 25 4
gpt4 key购买 nike

我目前正在对我正在处理的包运行 R CMD Check,但是在检查包的示例时我收到一条错误消息。大多数文件似乎都很好,这是检查的倒数第二个文件,在检查示例时会引发此错误。我相信 base::assign()是 R CMD Check 在切换文件之间执行的操作,例如检查。由于其他文件不会发生此错误,我猜这是导致出现此错误的语法错误。

checking examples ... ERROR
Running examples in ‘smt-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: selComponentTracks
> ### Title: selComponentTracks
> ### Aliases: selComponentTracks
>
> ### ** Examples
... 349 lines ...
+ ## plot component tracks
+ #plotComponentTrackOverlay(folder=folder3,trackll.sel=trackll.sel)
+
+
+
+ base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv")
+ base::cat("selComponentTracks-methods", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t")
Error: unexpected symbol in:
"base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv")
base"
Execution halted

checking whether package ‘smt’ can be installed ... WARNING
Found the following significant warnings:
Warning: replacing previous import ‘stats::lag’ by ‘dplyr::lag’ when loading ‘smt’
See ‘/Users/sys/code/smt.Rcheck/00install.out’ for details.

checking for unstated dependencies in examples ... WARNING
Warning: parse error in file 'smt-Ex.R':
959:1: unexpected symbol
958: cleanEx()
959: nameEx
^

什么可能导致这种情况?有没有人有这个错误?

最佳答案

tl;博士 可能是某处示例中的左括号。
我将继续从@user2554330 的评论中发布这个答案(如果他们回来并为自己发布答案,我会很乐意删除):

Those lines look like things that check added. Since it thinks its own code contains an unexpected symbol, it probably means your example has an open parenthesis or something similar. Open smt-Ex.R in the smt.Rcheck directory, and see if your editor (RStudio?) spots the error, or just try to run it all until you get to the syntax error


在我的情况下,我也得到了一个带有错误消息的行号引用:你也可以 source("yourpackage.Rcheck/yourpackage-Ex.R", echo=TRUE)以帮助定位问题。

关于r - R CMD 检查中的意外符号库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52805161/

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