我正在尝试用devtools创建一个包。我想设置一些选项,以便自动填充描述文件。我似乎不能把它弄对。
这是一个很容易手动解决的问题,我想,但我希望它能在代码中工作。担心这个错误以后会影响到我。对合适的语法有什么建议吗?我把我的函数放在一个叫"R“的文件夹里。我将我的工作目录设置为R的父文件夹。然后:
library(devtools)
install_github("devtools")
options(devtools.desc.author="First Last <first.last@example.com> [aut, cre]")
options(devtools.desc.license="GPL-3")
load_all()这将输出以下内容:
No DESCRIPTION found. Creating default:
Package: mypackage
Title:
Description:
Version: 0.1
Authors@R: First Last <first.last@example.com> [aut, cre]
Depends: R (>= 3.0.1)
License: GPL-3
LazyData: true
Loading mypackage
Invalid DESCRIPTION:
Malformed Authors@R field:
<text>:1:7: unexpected symbol
1: First Last
^
Required fields missing:
Author Maintainer
See the information on DESCRIPTION files in section 'Creating R packages' of the 'Writing R Extensions' manual.我知道,在某种程度上,Authors@R字段可以/正在以某种方式取代Maintainer字段,但我想知道如何让它停止抛出错误,以及它们的含义。
提前感谢!
发布于 2013-07-16 04:00:52
不幸的是,您需要:
options(devtools.desc.author="'First Last <first.last@example.com> [aut, cre]'")因为Authors@R的内容必须是有效的R表达式。
或者使用utils包中的person函数:
authors_at_r <- paste0(
"'",
person(
"First",
"Last",
email = "first.last@example.com",
role = c("aut", "cre")),
"'"
)
options(devtools.desc.author=authors)https://stackoverflow.com/questions/17662713
复制相似问题