roxygen2

do not show function help document in building R package by roxygen2

你离开我真会死。 提交于 2019-12-04 16:33:26
问题 I am using devtools to build R package, and there are some functions that are NOT designed to be visible to end-users. However, since these functions involve calling C codes by .Call , so that I have to write @useDynLib above the function for automatic generation of .Rd files. In that way, when I build the package, even I did NOT include the @export for those functions, they nonetheless appear in the help document... Is there a way to suppress those functions even if they have been documented

Documenting equations with deqn and roxygen

偶尔善良 提交于 2019-12-04 08:59:07
问题 I'm using \deqn{}{} with roxygen2 to document equations for a function in a package. The LaTeX (the 1st argument to deqn ) renders fine because white space is ignored in LaTeX equations, but I have a problem with the ASCII (the 2nd argument to deqn ) representation. The problem is that my formatting is destroyed (it appears roxygen puts the entire deqn command on a "single line" and then wraps that line at ~60 columns or so). Is there a way to force roxygen2 to preserve the white space

C++ function not available

旧街凉风 提交于 2019-12-04 05:58:20
I have the following file cumsum_bounded.cpp #include <Rcpp.h> using namespace Rcpp; //' Cumulative sum. //' @param x numeric vector //' @param low lower bound //' @param high upper bound //' @param res bounded numeric vector //' @export //' @return bounded numeric vector // [[Rcpp::export]] NumericVector cumsum_bounded(NumericVector x, double low, double high) { NumericVector res(x.size()); double acc = 0; for (int i=0; i < x.size(); ++i) { acc += x[i]; if (acc < low) acc = low; else if (acc > high) acc = high; res[i] = acc; } return res; } I then Build & Reload and test out my new function.

How to specify in which order to load S4 methods when using roxygen2

你离开我真会死。 提交于 2019-12-04 03:14:14
I ran into following problem already multiple times. Say you have two classes, classA and classB described in the following files classA.R : #' the class classA #' #' This is a class A blabla #' \section{Slots}{\describe{\item{\code{A}}{a Character}}} #' @ name classA #' @rdname classA #' @exportClass classA setClass("classA",representation(A="character")) And classB.R #' the class classB #' #' This is a class B blabla #' \section{Slots}{\describe{\item{\code{B}}{an object of class A}}} #' @ name classB #' @rdname classB #' @exportClass classB setClass("classB",representation(B="classA")) I

Best practices for developing a suite of dependent R packages

拟墨画扇 提交于 2019-12-04 01:59:43
问题 I am starting to work on a family of R packages, all of which share substantial common code which is housed in its own package, lets call it myPackageUtilities . So I have several packages myPackage1 , myPackage2 , etc... All of these packages depend on every method in myPackageUtilities . For a real-world example, please see statnet on CRAN. The idea is that a future developer might create myPackageN , and instead of having to re-write/duplicate all of the supporting code, this future

Documenting function closures

雨燕双飞 提交于 2019-12-03 12:08:17
Suppose I have a function closure in my package, for example f = function(x) { x = x g = function(y) x <<- y h = function() x list(g = g, h = h) } l = f(5) l$g(10) l$h() What is the correct (in the official CRAN sense) way of documenting this function? In particular, I would like to use roxygen2 I would like to provide documentation for the functions g and h One way would be to do something similar to ?family where you document g() and h() in the Value section of the .Rd file. Then provide extended documentation about g() and h() in a bespoke \section{foo} , which you point to in the Value

do not show function help document in building R package by roxygen2

泄露秘密 提交于 2019-12-03 11:24:23
I am using devtools to build R package, and there are some functions that are NOT designed to be visible to end-users. However, since these functions involve calling C codes by .Call , so that I have to write @useDynLib above the function for automatic generation of .Rd files. In that way, when I build the package, even I did NOT include the @export for those functions, they nonetheless appear in the help document... Is there a way to suppress those functions even if they have been documented? Thanks! alittleboy According to Hadley's comments, use @keywords internal will make the function

R CMD check warning: Functions/methods with usage in documentation object … but not in code

时光怂恿深爱的人放手 提交于 2019-12-03 11:17:05
问题 I am writing a package but one persistent R CMD check warning prevents me from finishing the package and posting it to CRAN. I use roxygen2 for inline documentation, although that possibly isn't the root cause of the error. If you know what to do to remove this warning, I can quite possibly figure out a way of doing it using roxygen2 . How can I remove the warning Functions/methods with usage in documentation object ... but not in code from my package checks? The R CMD check warning: *

documenting dataset with roxygen2

◇◆丶佛笑我妖孽 提交于 2019-12-03 09:59:18
I'm trying to document some datasets in an R package using roxygen2. Considering just one of these: I have mypkg/data/CpG.human.GRCh37.RDa which contains an object called CpG.human.GRCh37 and a file called: mypkg/R/cpg-data.R , which contains: #' @name CpG.human.GRCh37 #' @title CpG islands - human - genome build: GRCh37/hg19 #' @description This data set list the genomic locations of human CpG islands, #' with coordinates based on the GRCh37 / hg19 genome build. #' @docType data #' @usage CpG.human.GRCh37 #' @format a \code{RangedData} instance, 1 row per CpG island. #' @source UCSC Table

why roxygen2 does not automatically update “Imports” in DESCRIPTION file?

风流意气都作罢 提交于 2019-12-03 09:51:07
I am trying to follow closely @hadley's book to learn best practices in writing R packages. And I was thrilled to read these lines about the philosophy of the book: anything that can be automated, should be automated. Do as little as possible by hand. Do as much as possible with functions. So when I was reading about dependencies and the (sort of) confusing differences between import directives in the NAMESPACE file and the "Imports:" field in the DESCRIPTION file, I was hoping that roxygen2 would automatically handle both of them. After all Every package mentioned in NAMESPACE must also be