If you have a setClassUnion statement in your code, roxygen2 (version 5.0.1) will throw a missing name error when you build the package (done using RStudio 0.99.903, on a Windows 7 machine). If you move the setClassUnion statement above of all the roxygen2 documentation statemetns , i.e. everything starting #' @xxxx then the error goes away. If you are just trying to document a class union, then the documentation is not produced.
The text was updated successfully, but these errors were encountered:
Please provide a reproducible example. There are three things you need to include to make your example reproducible: required packages, data, and code.
Packages should be loaded at the top of the script, so it's easy to
see which ones the example needs. This is a good time to check that you're
using the latest version of each package: it's possible you've discovered
a bug that been fixed since you installed the package.
The easiest way to include data in a question is to use dput() to
generate the R code to recreate it. For example, to recreate the mtcars
dataset in R, I'd perform the following steps:
Run dput(mtcars) in R
Copy the output
In my reproducible script, type mtcars <- then paste.
Try and find the smallest subset of your data that still reveals
3. Spend a little bit of time ensuring that your code is easy for others to
Make sure you've used spaces and your variable names are concise, yet
Use comments to indicate where your problem lies.
Do your best to remove everything that is not related to the problem.
The shorter your code is, the easier it is to understand, and the
easier it is to fix.
Finish by checking that you have actually made a reproducible example by starting a fresh R session and copying and pasting your script in.
Here is an example that will cause the error. When you try to build a package which includes this as a standalone file, you get a "Missing Name' error. As far as I can tell it does not matter what the members of the union are. If you move the SetClassUnion function to the top of the file, then the package will build, but no documentation will be produced. If you have a setClassUnion and some other functions or method definitions you need to put the setClassUnion at the beginning, but if you do that the package will build and produce the correct documentation.
#' @title S4 Class Union that roxgygen 2 does not like
#' @description This is an example that will cause an error with roxygen2 package build. The error is "Missing name at NumericList.R:7"
#' @exportClass NumericList