Comments (2)
That line of code prevents inserting of a usage section for non-function objects (e.g. data or package). If we just remove that line and reinstall the package, we get problems when documenting data or packages:
library(roxygen2)
roc <- rd_roclet()
out <- roc_proc_text(roc, "
#' Data
#' @docType data
x <- 1:10")[[1]]
roxygen2:::get_tag(out, "usage")$values
With the proposed change, we will get x()
for usage which will show up in the output Rd file, which is obviously not what we want for data.
So we need another way of distinguishing function from non-function documentation if we want usage sections to come up for functions without parameter (and I agree this is a good thing!). One way to do this is to delete that line and replace it with:
if(!is.null(partitum$docType)) return()
With this change, if the user has used the @docType
tag (i.e. package
, data
, or method
/class
for S4), which the user needs to pass R CMD check
anyway for those kinds of objects, then this doesn't attempt to create usage from the function definition; otherwise it does even if there are no arguments. With that change in the code reinstalled in the package, my example produces NULL
for usage and your example produces f()
.
from roxygen.
If there is a way to check whether the object is a function or not, it will be more straightforward to fix this issue. I did not dig deeply enough into roxygen2, so I do not know. Anyway, I believe your fix should work well. I cannot think of other cases that it can possibly fail.
Thanks a lot!
from roxygen.
Related Issues (20)
- Checking for missing S3 method exports hangs "forever" if you have large data objects in the package HOT 2
- @include tag does not handle line breaks
- Support for inheriting S4 slots
- The definition of multiple @field field_1,field_2 in R6 object shows a warning.
- Adding "#' @inheritDotParams system" to roxygen comments causes devtools::document() to fail
- R-CMD Check Warning - Missing link or links in documentation object
- roxygenise() has side-effect of attaching the package HOT 1
- uninformative error message if comments within a function are #' rather than #
- `reexports.Rd` re-writes `lubridate` functions re-exported HOT 1
- If no public methods provided and cloneable is `FALSE`, roxygen2 will failed
- Always resolve to "anchored" Rd xrefs
- @export generates a wrong NAMESPACE directive for S3 methods of generics imported from a different package
- Allow for width/height setting when specifying an external image via markdown
- Unnecessary escaping of `%` inside multi-line character in R
- Improve indentation/wrapping for named vectors/lists in `\usage{}` blocks
- FR: add `is_md` to `parse_file()`
- The language is not respected when running inline code
- Homegrown `local_reproducible_output()` should set `cli.hyperlink = FALSE`
- `\usage()` length
- Markdown support for definition lists?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from roxygen.