roxygen

Multiple functions in one .Rd file

人走茶凉 提交于 2019-11-29 20:35:12
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 distribution e.g. stats::dnorm() . When I search ?dnorm I find the name of the help section is Normal

When writing my own R package, I can't seem to get other packages to import correctly

半世苍凉 提交于 2019-11-28 22:38:29
Alright, first attempt at writing an R package and I'm stuck. Here's how I create the package: package.skeleton("pkg",code_files=some.filenames) roxygenize("okg") I'm using roxygen2 and have the following imports in my "pkg-package.R" file: @import data.table zoo lubridate From a terminal, I then run: R CMD build pkg R CMD check pkg R CMD install pkg During the check phase, I get the following warnings: ** preparing package for lazy loading Warning: replacing previous import ‘hour’ when loading ‘lubridate’ Warning: replacing previous import ‘mday’ when loading ‘lubridate’ Warning: replacing

How to properly document S4 “[” and “[<-“ methods using roxygen?

空扰寡人 提交于 2019-11-28 19:29:35
Below I posted a mini example in which I want do write documentation for an “[“ method for a S4 class. Does someone know how to properly document a method for the generic "[" using roxygen and S4? I get a warning when checking the package after building (see below). #' An S4 class that stores a string. #' @slot a contains a string #' @export setClass("testClass", representation(a="character")) #' extract method for testClass #' #' @docType methods #' @rdname extract-methods setMethod("[", signature(x = "testClass", i = "ANY", j="ANY"), function (x, i, j, ..., drop){ print("void function") } )

Using Roxygen2 Template tags

耗尽温柔 提交于 2019-11-28 18:45:32
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 examples etc. When these things are nested within a set of functions I have been using @inheritParms . But

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

Escaping “@” in Roxygen2 Style Documentation

倾然丶 夕夏残阳落幕 提交于 2019-11-28 10:46:39
Let's say I have a comment block where I'd like to write an email address. How would I go about escaping the "@" symbol so roxygen treats it as text instead of a directive? Josh O'Brien A double at-sign @@ will do the job. As an example, take the email address in the author field of this documentation: ##' A package to check Roxygen's sanity. ##' @name helloRoxygen-package ##' @docType package ##' @author My name \email{me@@here.org} NA which produces this *.Rd file when processed with roxygenize() : \docType{package} \name{helloRoxygen-package} \alias{helloRoxygen-package} \title{A package to

Using source subdirectories within R packages with roxygen2

ぃ、小莉子 提交于 2019-11-28 09:13:17
I would like to use a directory structure within the R folder for the source code of a package. For example, within my R folder I have an algos folder with functions I want to export and document. However roxygen2 by default does not seem to go through the subfolders of the R folder. I tried to use the @include keyword as follows for a file at `R/algos/algo1.r' #' @include algos/algo1.r but without success. Is there a simple way to use subfolder for the R source code? Writing R Extensions has this to say (in Section 1.1.5 ) about subdirectories under the R directory: The R and man

Automatic documentation of datasets

喜欢而已 提交于 2019-11-28 03:51:31
I'm working on a project right now where I have been slowly accumulating a bunch of different variables from a bunch of different sources. Being a somewhat clever person, I created a different sub-directory for each under a main "original_data" directory, and included a .txt file with the URL and other descriptors of where I got the data from. Being an insufficiently clever person, these .txt files have no structure. Now I am faced with the task of compiling a methods section which documents all the different data sources. I am willing to go through and add structure to the data, but then I

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 a S3 method of a generic from a different package, using Roxygen?

我们两清 提交于 2019-11-27 18:57:17
I am writing a package that defines a new class, surveyor, and a print method for this, i.e. print.surveyor . My code works fine and I use roxygen for inline documentation. But R CMD check issues a warning: Functions/methods with usage in documentation object 'print.surveyor' but not in code: print I have used the following two pages, written by Hadley, as inspiration: Namespaces and Documenting functions , both of which states that the correct syntax is @method function-name class So my question is: What is the correct way of documenting the print method for my new class using Roxygen? And