r - devtools::document 尝试将目录作为文件打开
问题描述
我正在尝试使用devtools::document()
为 R 包构建 man 文件。但是,当我document()
从包裹内调用时,我得到以下信息:
Updating xpcaR documentation
Loading xpcaR
Error in file(con, "r") : cannot open the connection
Calls: suppressPackageStartupMessages ... roxy_tag_rd.roxy_tag_example -> read_lines -> <Anonymous> -> file
In addition: Warning messages:
1: In file(con, "r") :
'raw = FALSE' but '/Users/andersonberg1/Documents/GitLab/xpcar/xpcaR/' is not a regular file
2: In file(con, "r") :
cannot open file '/Users/andersonberg1/Documents/GitLab/xpcar/xpcaR/': it is a directory
Execution halted
Exited with status 1.
警告是完全正确的:.../xpcaR/
是一个目录,而不是一个文件。实际上,它是我调用时所在的目录document()
。为什么它试图将目录作为文件打开?
我目前的想法是,由于某种原因,它正在寻找一些文件名,然后是空的,所以当它出现时
full_filename = paste0(path2package, filename)
filename
是 NULL 所以它最终只是一个包的路径。但是,我不知道为什么会这样。
解决方案
我意识到问题在于我正在编写一个#' @example
,但尚未填写该字段。简而言之
#' ...
#' @examples
#' @export
foo = function(){}
导致上述错误,但是
#' ...
#' @examples
#' print("Hello world")
#' @export
foo = function(){}
解决它。
推荐阅读
- javascript - Phaser 3: "Too many active WebGL contexts. Oldest context will be lost." warning and memory leak
- c# - 没有在课堂上获得价值
- javascript - 如何防止生成空的Birt报告
- ios - iOS Swift UIImage animation got struck while doing db and webservice stuff
- php - 具有多个 WHERE 和 SELECT 条件的更新 - MySql
- jquery - 使用 jquery 获取 textarea 值不起作用
- elasticsearch - How can I merge two events in logstash?
- excel - 使用条件规则复制/过去格式
- c# - 如何根据另一个列表的元素和条件从一个列表中删除元素?
- java - Jax-RS 响应来自 HTML/文本而不是 JSON