r - Overwriting NAMESPACE and Rd with roxygen2 -


i create new package rstudio. in "configure build tools", check "generate documentation roxygen".

the first time click on "document" in "build" pane, works fine:

==> roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))  first time using roxygen2. upgrading automatically... writing hello.rd writing namespace documentation completed 

i namespace:

# generated roxygen2: not edit hand  export(hello) 

and file hello.rd:

% generated roxygen2: not edit hand % please edit documentation in r/hello.r \name{hello} \alias{hello} \title{hello} \usage{ hello(x) } \arguments{ \item{x}{string} } \value{ string } 

but now, modify file hello.r, , 2 problems. firstly, window appears:

enter image description here

if click on "yes", nothing happens.

secondly, seems roxygen2 cannot overwrite hello.rd, because text in "build" pane:

==> roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))  error: specified file not readable: u:\data\rtests\testpackage\man/hello.rd execution halted  exited status 1. 

the way found update documentation run:

roxygen2::roxygenize(clean=true) 

this command firstly cleans everything, namespace , rd files, , generates namespace , rd files.

i don't know whether issue path of rtools. tried set path doing:

sys.setenv(path="%path%;c:/program files/rtools/gcc-4.6.3/bin;c:/program files/rtools/gcc-4.6.3/bin64;c:/program files/rtools/gcc-4.6.3/i686-w64-mingw32/bin;c:/program files/rtools/bin") 

but not solve issue.

i'm using:

  • roxygen2 5.0.1

  • rstudio 0.99.892

  • windows 7

  • r version 3.3.1

cause of problem.

the roxygen2 package depends on digest package. error (the specified file not readable) generated digest function of digest package, @ moment when function calls 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 u:/data has not read permission. not true: has read permission. problem u: drive "network drive", , there issues file.access function network drives, can see here example: https://github.com/eddelbuettel/digest/issues/13.

a workaround

the problem solved if r.utils::fileaccess used instead of file.access in digest::digest function.

so, firstly take code of digest::digest function , modify 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   .... code of digest function here ... } 

then do:

library(digest) r.utils::reassigninpackage("digest", "digest", mydigest) 

and documentation can updated doing:

roxygen2::roxygenize() 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -