题
跑步 R CMD roxygen
大包装可能需要很长时间。显然,这显然是效率低下的,并且无论文件是否已更改,自上次roxygen调用以来,它都会经历所有内容。
关于如何加快事情的任何提示?
解决方案
roxygen2> 3.0.0速度更快,不再需要缓存。
在我本地版本的roxygen中,我有:
library(memoize)
cached.parse.ref <- memoize(parse.ref)
cached.parse.srcfile <- memoize(parse.srcfile)
parse.file <- function(file) {
srcfile <- srcfile(file)
res <- try(cached.parse.srcfile(srcfile), silent = TRUE)
if (inherits(res, "try-error")) {
stop("Can't pass", file, "\n", res, call. = FALSE)
}
res
}
parse.srcfile <- function(srcfile) {
srcrefs <- attributes(parse(srcfile$filename,
srcfile=srcfile))$srcref
if (length(srcrefs) > 0)
parse.refs(zip.list(prerefs(srcfile, srcrefs), srcrefs))
else
nil
}
我认为这些是您需要的唯一更改,但我不确定。它通过一个数量级加速了roxygen。
不隶属于 StackOverflow