Overwriting NAMESPACE and Rd with roxygen2

一个人想着一个人 提交于 2019-12-04 17:18:08

Cause of the problem.

The roxygen2 package depends on the digest package. The error (The specified file is not readable) is generated by the digest function of the digest package, at the moment when this function calls the file.access function: https://github.com/eddelbuettel/digest/blob/master/R/digest.R#L102.

I get:

> file.access("U:/Data", 4)
U:/Data 
     -1 

That means that U:/Data has not the read permission. But this is not true: it has the read permission. The problem is that my U: drive is a "network drive", and there are some issues with the file.access function for network drives, as we can see here for example: https://github.com/eddelbuettel/digest/issues/13.

A workaround

The problem would be solved if R.utils::fileAccess would be used instead of file.access in the digest::digest function.

So, firstly take the code of the digest::digest function and modify it as follows.

mydigest <- function (object, algo = c("md5", "sha1", "crc32", "sha256", 
    "sha512", "xxhash32", "xxhash64", "murmur32"), serialize = TRUE, 
    file = FALSE, length = Inf, skip = "auto", ascii = FALSE, 
    raw = FALSE, seed = 0, errormode = c("stop", "warn", "silent")) 
{
  file.access <- R.utils::fileAccess
  .... the code of the digest function here ...
}

Then do:

library(digest)
R.utils::reassignInPackage("digest", "digest", mydigest)

And now the documentation can be updated by doing:

roxygen2::roxygenize()
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!