For instance, as a minimal working example, say I have built the following package Test
:
# In R\Test.R :
#' @import methods
#' @exportClass C
C <- setClass("C")
and now I change setClass
to setRefClass
:
C <- setRefClass("C")
when doing a 'Build & Reload' (in RStudio) I get the error
==> roxygenize('.', roclets=c('rd', 'collate', 'namespace'))
* checking for changes ... ERROR
Error in getRefClass(class) :
class �C� is defined but is not a reference class
Well, of course it isn't a reference class yet, but in my updated package it will be! Checking the old class definition also throws up weird warnings:
> getClass("C")
Virtual Class "C" [package "Test"]
No Slots, prototype of class "NULL"
Warning message:
In .recacheSubclasses(def@className, def, doSubclasses, env) :
undefined subclass "C" of class "refObject"; definition not updated
It appears Roxygen ignores my new definition of C
and the old class definition still stands. How can I get Roxygen to focus on my new definition and for my rebuild to succeed?
(Note that this problem is not specific to setClass
- I'm just using it as an example.)
My setup:
I have Roxygen set up in RStudio to run before I rebuild, so that my NAMESPACE file is updated automatically if my @export
s etc change.
- Roxygen2 3.0.0
- Using roxygen to generate (in RStudio):
- Rd files
- Collate field
- NAMESPACE file
- Automatically roxygenising when running (in RStudio):
- R CMD check
- Source and binary package builds
- Build & Reload
- Using roxygen to generate (in RStudio):
- R: 3.0.2 (Frisbee Sailing)
- IDE: RStudio 0.98.490
- OS: Windows 8.1