roxygen2 | Generate R package documentation from inline R comments

 by   r-lib R Version: v7.2.3 License: Non-SPDX

kandi X-RAY | roxygen2 Summary

kandi X-RAY | roxygen2 Summary

roxygen2 is a R library. roxygen2 has no bugs, it has no vulnerabilities and it has low support. However roxygen2 has a Non-SPDX License. You can download it from GitHub.

The premise of roxygen2 is simple: describe your functions in comments next to their definitions and roxygen2 will process your source code and comments to automatically generate .Rd files in man/, NAMESPACE, and, if needed, the Collate field in DESCRIPTION.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              roxygen2 has a low active ecosystem.
              It has 535 star(s) with 217 fork(s). There are 20 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 90 open issues and 959 have been closed. On average issues are closed in 166 days. There are 6 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of roxygen2 is v7.2.3

            kandi-Quality Quality

              roxygen2 has 0 bugs and 0 code smells.

            kandi-Security Security

              roxygen2 has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              roxygen2 code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              roxygen2 has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              roxygen2 releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of roxygen2
            Get all kandi verified functions for this library.

            roxygen2 Key Features

            No Key Features are available at this moment for roxygen2.

            roxygen2 Examples and Code Snippets

            No Code Snippets are available at this moment for roxygen2.

            Community Discussions

            QUESTION

            R package documentation: "Found the following apparent S3 methods exported but not registered"
            Asked 2022-Mar-01 at 13:51

            I receive the following note when trying to check my package: Found the following apparent S3 methods exported but not registered: is.nan.data.frame.

            Here is my document that I use with roxygen2 to create the package documentation:

            ...

            ANSWER

            Answered 2022-Mar-01 at 13:51

            I don't know Roxygen2 very well, but it appears that you have declared is.nan.data.frame to be the is.nan method for class data.frame. Since you did that, you should call it as is.nan(df) in the help page example.

            If you don't want it to be the method, you just want it to be a regular function using dots in the name, then you shouldn't have @method is.nan data.frame. But you indicate that you do want it to be a method.

            Edited to add: Just to summarize your comments, the following fixes got rid of all the errors:

            • use @export by itself without naming the function (as suggested by @KonradRudolph)
            • remove the @usage line
            • use is.nan(df) in the example (as I suggested)

            Source https://stackoverflow.com/questions/71308896

            QUESTION

            R help pages with multiline LaTeX equations
            Asked 2022-Feb-18 at 17:37

            I am writing R package documentation with roxygen2. I want to insert the following multiline equation into a help page, but my LaTeX code is not being rendered.

            ...

            ANSWER

            Answered 2022-Feb-18 at 17:37

            Just to demonstrate that it's possible once you've integrated mathjaxr correctly:

            Source https://stackoverflow.com/questions/71167883

            QUESTION

            How to insert function input documentation in R vignette?
            Asked 2022-Jan-22 at 10:48

            I want to write a vignette explaining my R package. Inside the vignette, I want to explain one input to a certain function.

            Basically, what I would write in the vignette is the same as I wrote in the @param section of the roxygen comments to my function.

            To avoid writing the same things twice, is there a way that I can insert the roxygen2 description of a function input into a vignette?

            ...

            ANSWER

            Answered 2022-Jan-22 at 10:48

            QUESTION

            R CMD check gives warning when using @includeRmd for examples using Roxygene
            Asked 2022-Jan-22 at 03:41

            I'm writing an R package using roxygen2 for documentation. I'm using the @includeRmd tag to reduce duplication, and this works well to generate consistent documentation across the help files, vignette, and pkgdown website.

            My only issue is that, when I use the tag to insert examples, R CMD check gives me a nasty warning. Here is my setup:

            R/adder.R ... source code for function with roxygen2 block

            ...

            ANSWER

            Answered 2022-Jan-22 at 01:03

            Your usage of the @includeRmd tag does not appear to be supported. You can use it to generate a Description or (sub)sections of Details, but not Examples. The documentation states:

            It is currently not possible to document function arguments, return values, etc. in external Rmd documents.

            That isn't too surprising, for a couple of reasons:

            • R CMD check expects the \examples{} block to contain verbatim R code, not Markdown, so injecting Markdown into the block without preprocessing is doomed to fail. Due to the chunk header and footer, the following is not valid R code:

            Source https://stackoverflow.com/questions/70805727

            QUESTION

            R package documentation: link to a whole package, not function
            Asked 2022-Jan-10 at 17:35

            I want to cite another package (the whole package, not just a function from it) in the documentation of some functions I'm developing. I am using Roxygen2 comments to document my package functions.

            I cannot find a way to create a link to a whole third-party package using Roxygen2. To link to a package function, one would write [pkg::fun()] but I don't know how to create a link to the package itself.

            Some packages expose a general man page, and it's possible to link to it via e.g. [pkg::pkg].

            But many packages don't have this and there's just a general package vignette with the list of functions and a link to the description:

            Such page can be reached by clicking on a package name in the packages tab in RStudio.

            How can I link to it from a function documentation made in Roxygen2 markdown.?

            ...

            ANSWER

            Answered 2022-Jan-10 at 17:35

            You cannot link to the page that comes up when you click on the name of a package in RStudio's Packages pane. RStudio invisibly calls help(package = ""), which renders the package's index.

            From the R-exts manual:

            The markup \link{foo} (usually in the combination \code{\link{foo}}) produces a hyperlink to the help for foo. Here foo is a topic, that is the argument of \alias markup in another Rd file (possibly in another package).

            Hence \link and the equivalent Markdown markup supported by roxygen2 can only link to topics. A package index is not a topic in this sense because there is no corresponding Rd file.

            It might be best just to remind users that they can use help to access the index of the package to which you are referring.

            Source https://stackoverflow.com/questions/70654391

            QUESTION

            How to put units inside roxygen
            Asked 2022-Jan-03 at 15:20

            I am docummenting a dataset using roxygen2 (for my package development). I am trying to put cube meter (m^2) as a unit for one of my variable but it remains the same (m^2) when I am trying to see the documentation ?data. How can I generate units inside roxygen2?

            Thank you

            ...

            ANSWER

            Answered 2022-Jan-03 at 15:20

            You should use this line:

            Source https://stackoverflow.com/questions/70567601

            QUESTION

            R Function 'box::help()' Cannot Generate Help File: "Invalid Argument"
            Asked 2021-Dec-30 at 16:38
            Motivation

            My colleagues and I routinely create ad hoc scripts in R, to perform ETL on proprietary data and generate automated reports for clients. I am attempting to standardize our approach, for the sake of consistency, modularity, and reusability.

            In particular, I want to consolidate our most commonly used functions in a central directory, and to access them as if they were functions from a proprietary R package. However, I am quite raw as an R developer, and my teammates are even less experienced in R development. As such, the development of a formal package is unfeasible for the moment.

            Approach

            Fortunately, the box package, by Stack Overflow's very own Konrad Rudolph, provides (among other modularity) an accessible approach to approximate the behavior of an R package. Unlike the rigorous development process outlined by the RStudio team, box requires only that one create a regular .R file, in a meaningful location, with roxygen2 documentation (#') and explicit @exports:

            Writing modules

            The module bio/seq, which we have used in the previous section, is implemented in the file bio/seq.r. The file seq.r is, by and large, a normal R source file, which happens to live in a directory named bio.

            In fact, there are only three things worth mentioning:

            1. Documentation. Functions in the module file can be documented using ‘roxygen2’ syntax. It works the same as for packages. The ‘box’ package parses the
              documentation and makes it available via box::help. Displaying module help requires that ‘roxygen2’ is installed.

            2. Export declarations. Similar to packages, modules explicitly need to declare which names they export; they do this using the annotation comment #' @export in front of the name. Again, this works similarly to ‘roxygen2’ (but does not require having that package installed).

            At the moment, I am tinkering around with a particular module, as "imported" into a script. While the "import" itself works seamlessly, I cannot seem to access the documentation for my functions.

            Code

            I am experimenting with box on a Lenovo ThinkPad running Windows 10 Enterprise. I have created a script, aptly titled Script.R, whose location serves as my working directory. My module exists in the relative subdirectory ./Resources/Modules as the humble file time.R, reproduced here:

            ...

            ANSWER

            Answered 2021-Jul-30 at 23:42

            As noted, that’s a bug, now fixed.

            But since we’re here, a word on usage:

            Source https://stackoverflow.com/questions/68583772

            QUESTION

            Where are objects stored in R packages?
            Asked 2021-Nov-30 at 18:08

            I am refactoring an R package of another author (previous employee of my company). The author uses multiple variables in the roxygen2 examples that apparently are stored somewhere in the package. They are accessible with pkgname:::bar. I renamed some of these variables across the entire package to improve naming consistency, let's say the variable is called foo instead of bar now, but the examples are not running any more upon devtools::check(). The error: Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : object 'foo' not found. However, I cannot find where they are defined. There are no objects in the data folder that would be named bar and searching for the variable name within all files (in RStudio and in Windows Explorer) does not reveal anything. Yet, pkgname:::bar still works. Any ideas where I should look for bar?

            ...

            ANSWER

            Answered 2021-Nov-30 at 18:08

            Variables can also be created in a normal R script of the package with foo <- new.env() and then populated with content, e.g.

            Source https://stackoverflow.com/questions/70173608

            QUESTION

            Why does cirlceCI does not build successfully when renv is part of a R package?
            Asked 2021-Nov-22 at 04:34

            Im trying to set up a CI for a R package. In that regard I`m considering circleCI, which has worked out with previous R projects. However this time, I get the following error:

            ...

            ANSWER

            Answered 2021-Nov-22 at 04:34

            The issue here is most likely that your run stage, here:

            Source https://stackoverflow.com/questions/70057936

            QUESTION

            Writing roxygen documentation without saving .rd files?
            Asked 2021-Nov-19 at 14:33

            Is there a way to write roxygen2 tags for a function without devtools::document() saving Rd files? I like the roxygen2-style for internal documentation (for other developers) of stuff that will never concern the end user. Right now, the "unnecessary" rd files end up shipping with the package.

            Ideally, something like a @noRd tag:

            ...

            ANSWER

            Answered 2021-Nov-19 at 12:15

            There literally is a @noRd tag! I just didn't see it documented anywhere. Problem solved.

            Source https://stackoverflow.com/questions/70034655

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install roxygen2

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link