roxygen2

Multiple functions in one .Rd file

你离开我真会死。 提交于 2019-11-28 16:38:45
问题 Short version : Can I emulate the documentation of Normal in package stats using roxygen ? Long version : I'm working on a package and was trying make the documentation more readable by having a number of functions with common inputs/parameters collected under one heading, which will be a generic reference to the group. Each function should still be available to the end user independently. I took as inspiration the documentation for Normal which gives a number of methods related to the normal

How to not run an example using roxygen2?

我们两清 提交于 2019-11-28 06:07:42
I'm writing a geocoding function right now that relies on having a Bing Maps Key. Obviously I'd rather not publish mine, and the examples fail without one. How do I include an example for users to run manually, but not have it executed during R CMD check ? Use \dontrun{} #'@examples #'\dontrun{ #'geocode("3817 Spruce St, Philadelphia, PA 19104") #'geocode("Philadelphia, PA") #'dat <- data.frame(value=runif(3),address=c("3817 Spruce St, Philadelphia, PA 19104","Philadelphia, PA","Neverneverland")) #'geocode(dat) #'} You can use \donttest{} to your example. The snippet will be provided in your

How to properly document S4 methods using roxygen2

孤街醉人 提交于 2019-11-28 03:04:13
I've seen some discussions in SO and other places regarding how this should be or will be done in future versions of Roxygen2. However, I am stuck. How should I go about documenting a S4 generic, as well as its methods, using Roxygen2? A working example for a brand new generic/methods, as well as an example for extending base S4 generic would be incredibly useful. I do not want to have to make separate (mostly) redundant documentation for each S4 method of the same generic. Due dilligence: I have tracked down a useful example for the "extract" method. However, it appears to be outdated and

Does roxygen2 automatically write NAMESPACE directives for “Imports:” packages?

笑着哭i 提交于 2019-11-27 18:57:25
tl;dr version of my question If I want to import packages, do I have to manually write import() directives into my NAMESPACE file? It seems like roxygen2 won't magically do that for me, even if I have them listed as "Imports:" in my description. Fuller Version This is a pretty dumb question, but I ask because the answer's not obvious to me. I use roxygen2 to handle my R package documentation. When I want to be sure a function is exported, I add an @export tag to its roxygen block. Subsequent runs of roxygenize() will write the NAMESPACE directive accordingly. But, my package currently imports

How to properly document S4 class slots using Roxygen2?

老子叫甜甜 提交于 2019-11-27 16:57:21
For documenting classes with roxygen(2), specifying a title and description/details appears to be the same as for functions, methods, data, etc. However, slots and inheritance are their own sort of animal. What is the best practice -- current or planned -- for documenting S4 classes in roxygen2? Due Diligence: I found mention of an @slot tag in early descriptions of roxygen. A 2008 R-forge mailing list post seems to indicate that this is dead, and there is no support for @slot in roxygen: Is this true of roxygen2? The previously-mentioned post suggests a user should instead make their own

Keyboard shortcut for inserting roxygen #' comment start

三世轮回 提交于 2019-11-27 15:54:27
问题 This question might be over-answered but I could not find one. Basically I am using RStudio and the keyboard shortcut cmd + shift + c for inserting comments. Is there an other combination to insert directly the roxygen tags #' ? Or a way to modify RStudio to tell it to add the ' when I press cmd + shift + c ? 回答1: You could use an RStudio addin, you'll need a fairly recent version of RStudio. I've just created an RStudio addin that comments/uncomments using roxygen2 tags, i.e. works just like

Exporting non-S3-methods with dots in the name using roxygen2 v4

蹲街弑〆低调 提交于 2019-11-27 13:38:46
Since roxygen2 version 4.0.0 , the @S3method tag has been deprecated in favour of using @export . The package now tries to detect if a function is an S3 method, and automatically adds the line S3method(function,class) to the NAMESPACE file if it think it is one. The problem is that if a function is not an S3 method but its name contains a . then roxygen sometimes makes a mistake and adds the line when it shouldn't. Is there a way to tell roxygen that a function is not an S3 method? As requested, here's a reproducible example. I have a package that imports R.oo , with a function named check.arg

Using Roxygen2 Template tags

不想你离开。 提交于 2019-11-27 11:14:35
问题 Could someone provide an example of how to properly use the Template Tags in Roxygen2 . I have tried to do the most obvious thing (to me): In my packageName-package.R file: #' [... other Roxygen blocks ...] #' #' @templateVar testTemplateTag Testing one two NULL Then in a file someFunction.R #' [... other Roxygen blocks ...] #' #' @template testTemplateTag I get the error: Error : Can not find template testTemplateTag I am trying to have one place to document commonly repeated definitions

Error in fetch(key) : lazy-load database

烈酒焚心 提交于 2019-11-27 10:05:16
问题 I don't know what is going on, everything was working great but suddenly I started to have this error message on the documentation: Error in fetch(key) : lazy-load database '......descopl.rdb' is corrupt I removed almost all my code and build again then publish to Github, but when I use the other laptop to download the package, the package is being downloaded and loaded but I can't call any of the functions, and the documentation states that error. I don't know what caused the problem, I am

Importing two functions with same name using roxygen2

浪尽此生 提交于 2019-11-27 01:43:47
I'm a maintainer of a CRAN package and get the following messages when loading: * checking whether package ‘qdap’ can be installed ... [10s/10s] WARNING Found the following significant warnings: Warning: replacing previous import ‘annotate’ when loading ‘NLP’ Warning: replacing previous import ‘rescale’ when loading ‘scales’ Because I use the plotrix and scales packages as well as the NLP and ggplot packages. They have the functions rescale and annotate in common. This results in a significant warning with the latest CRAN check. So I decide to "fix" it. I made the description something like