Roxygen2 引入 \n 作为默认参数值。导致Codoc不匹配

发布于 2024-12-10 02:38:22 字数 1309 浏览 0 评论 0原文

我遇到了与此帖子相反的问题。似乎 roxygen 将 \n 引入到我的默认参数值中,这导致 R CMD 检查为 WARN

这是我的函数定义:

WriteToExcel <- function( filePath = stop( "filePath must be specified" ) , worksheet = stop( "worksheet must be specified" ) , toWrite = stop( "toWrite must be specified" ) , rownames = FALSE )
{
 ...
}

这是警告:

Codoc mismatches from documentation object 'WriteToExcel':
WriteToExcel
  Code: function(filePath = stop("filePath must be specified"),
                 worksheet = stop("worksheet must be specified"),
                 toWrite = stop("toWrite must be specified"), rownames
                 = FALSE)
  Docs: function(filePath = stop("filePath must be\n specified"),
                 worksheet = stop("worksheet must be\n specified"),
                 toWrite = stop("toWrite must be specified"), rownames
                 = FALSE)
  Mismatches in argument default values:
    Name: 'filePath' Code: stop("filePath must be specified") Docs: stop("filePath must be\n  specif
ied")
    Name: 'worksheet' Code: stop("worksheet must be specified") Docs: stop("worksheet must be\n  spe
cified")

我在这里遗漏了什么吗?

I'm having the opposite issues of this post. It seems that roxygen is introducing \n into my default parameter values which causes R CMD check to WARN

Here's my function definition:

WriteToExcel <- function( filePath = stop( "filePath must be specified" ) , worksheet = stop( "worksheet must be specified" ) , toWrite = stop( "toWrite must be specified" ) , rownames = FALSE )
{
 ...
}

And here's the warning:

Codoc mismatches from documentation object 'WriteToExcel':
WriteToExcel
  Code: function(filePath = stop("filePath must be specified"),
                 worksheet = stop("worksheet must be specified"),
                 toWrite = stop("toWrite must be specified"), rownames
                 = FALSE)
  Docs: function(filePath = stop("filePath must be\n specified"),
                 worksheet = stop("worksheet must be\n specified"),
                 toWrite = stop("toWrite must be specified"), rownames
                 = FALSE)
  Mismatches in argument default values:
    Name: 'filePath' Code: stop("filePath must be specified") Docs: stop("filePath must be\n  specif
ied")
    Name: 'worksheet' Code: stop("worksheet must be specified") Docs: stop("worksheet must be\n  spe
cified")

Am I missing something here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

穿透光 2024-12-17 02:38:22

看来这是一个已知问题。结束这个问题。

It seems this is a known issue. Closing out this question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文