roxygen2

S3 method help (roxygen2)

喜你入骨 提交于 2019-12-10 02:52:25
问题 I am trying to use a S3 method in a package and thought I understood how to set it up after asking a question here: S3 method consistency warning when building R package with Roxygen But now I get results I don't expect. If I run the code below directly in R it gives me the expected results but if I compile it into a package I don't get the correct results (notice the word the gets counted twice when it should take only unique words from vector a ). I'm not sure what I'm setting up

Overwriting NAMESPACE and Rd with roxygen2

谁说胖子不能爱 提交于 2019-12-09 19:57:36
问题 I create a new package with RStudio. In "Configure Build Tools", I check "Generate documentation with Roxygen". The first time I click on "Document" in the "Build" pane, everything works fine: ==> roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace')) First time using roxygen2. Upgrading automatically... Writing hello.Rd Writing NAMESPACE Documentation completed I get this NAMESPACE: # Generated by roxygen2: do not edit by hand export(hello) and this file hello.Rd : % Generated by

Renaming and Hiding an Exported Rcpp function in an R Package

前提是你 提交于 2019-12-09 17:37:05
问题 Writing an R package, I have a R function that calls a specific Rcpp function. The Rcpp function just serves as a helper function and I do not want to creat a .Rd file for it. My solution so far is to export both functions in the Namespace file which causes the warning to create an .Rd file for the Rcpp function as soon as I run the check command. If I remove the helper function in the Namespace file, I get rid of this warning causing now the problem that the R function is not able to find it

roxygen2 not creating .Rd documentation

半腔热情 提交于 2019-12-08 17:35:55
问题 I am unable to generate .Rd documentation files for my package using RStudio and Roxygen2. First, let me mention that I have gone through similar problems posted here and have already done the following: Roxygen2 blocks initiated at the beginning of file with a #' Configured Build Tools>Checked generate documentation with Roxygen> Configure > Checked all fields under 'Use roxygen to generate' and 'Automatically roxygenize when running' Made sure there were no .Rd files in the 'man' folder And

How to use @inheritParams on single parameters when multiple parameters match?

痞子三分冷 提交于 2019-12-08 14:55:51
问题 I would like to document an R function and inherit individual parameter documentation from other functions when multiple parameter names match. For example, lets say I have the following 2 functions. #' Function 1. #' #' Description of function 1. #' #' @param x XYZ #' @param y ZYX #' @return Numeric fun1 <- function(x, y) {value <- 1} #' Function 2. #' #' Description of function 2. #' #' @param x ABC #' @param y CBA #' @return Numeric fun2 <- function(x, y) {value <- 2} I now want to create

Use Roxygen to make S3method in NAMESPACE

断了今生、忘了曾经 提交于 2019-12-07 15:48:43
问题 I want to export an S3method named [.myclass using roxygen2 and I can't see a clean way to do this. I need NAMESPACE to have S3method("[",myclass) in it or the method can't be used after I require the package, but roxygen2 doesn't appear to want to help me with this. I can force it to with #' @S3method [ myclass setMethodS3("[", c(x="myclass"), function(x,i) { blah blah balh }) but roxygen then says that s3method is deprecated and that I should use @export instead, but #' @export setMethodS3(

Citing articles in R package using roxygen2 and BibTeX?

て烟熏妆下的殇ゞ 提交于 2019-12-06 17:01:15
问题 I'm using roxygen2 as a tool for documenting my R package, and I found that there is a @references tag in roxygen2, but that seems to only accept free form text. I found some presentation about roxygen which has tags @bibliograph and @cite, but am I correct that there is no such thing in roxygen2? Should I then somehow take the references out of the bibtex-file and write them manually with appropriate formatting directly after the @references tag or is there some more clever way of doing this

roxygen2: function not exported to NAMESPACE even after using @export

限于喜欢 提交于 2019-12-06 05:03:07
问题 I am building a package and get an error, saying that a function is not an exported object of the package. In the R script, I have used @export tag to export the function, however when I roxigenise using document() or roxygen() the function is not exported to the NAMESPACE (the Rmd file for that function is created though). 回答1: I had a similar problem. It turned out that inside my function I had commented out a line that began with an apostrophe (in front of 'Battlestar Galactica' in my fake

C++ function not available

匆匆过客 提交于 2019-12-06 01:58:17
问题 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

roxygen2 not generating NAMESPACE correctly

我与影子孤独终老i 提交于 2019-12-05 12:54:35
I have a package that builds successfully and without warnings under ubuntu 12.04. The package is pure R, and has approximately 70 functions (approx 2000 LOCs). When I try to build under Windows 7 in Rstudio, the package builds successfully (no warnings) but NAMESPACE contains export() for only a dozen functions. First time it happens to me, probably because I rarely use Windows. This happens under 3.1 and the latest version of Rstudio and roxygen2. Has it happened to any of you? What could be the cause of this? I have no idea if it's linked with your problem (which I hope have been solved