[Rd] Running examples with R5 constructor from package failing
Duncan Murdoch
murdoch.duncan at gmail.com
Sat Feb 1 23:03:28 CET 2014
On 14-02-01 4:21 PM, Imanuel Costigan wrote:> You referred to another
package that exports an R5 class. Which one?
I was looking at lme4, which doesn't have any reference classes, but
should be relevant since the setClass function behaves a lot like
setRefClass.
The ascii package does use setRefClass. I don't think it uses
exportClass though...
Duncan Murdoch
>
> Thanks for your help.
>
> On 02 Feb, 2014,at 12:57 AM, Duncan Murdoch <murdoch.duncan at gmail.com>
> wrote:
>
>> On 14-01-31 10:14 PM, Imanuel Costigan wrote:> I am having an issue with
>> reference classes (R5) in a package I am developing. They have both been
>> illustrated in the `roxygentest` package I've got hosted on Github [1].
>> >
>> > When I run `R CMD check .` on the source directory of my package I am
>> told that:
>> >> Error: could not find function "Blob"
>> >
>> > However, when I install and load the package, I can successfully run
>> the command in the example.
>> >
>> > Does someone know why this is happening?
>> >
>> > The relevant definitions and the example (in Rd format):
>> >
>> > R5 definition:
>> > ```
>> > draw.Blob <- function (type = 'small')
>> > {
>> > 'Something about blobs'
>> > type <<- 'small'
>> > }
>> >
>> > Blob <- setRefClass (
>> > Class = "Blob",
>> > fields = list(type = 'character'),
>> > methods = list(draw = draw.Blob)
>> > )
>> > ```
>> >
>> > Example:
>> > ```
>> > \examples{
>> > Blob(type = 'small')
>> > }
>> > ```
>>
>> The symptoms make it look as though the *function* Blob is not exported.
>> I see in your source that you do export the *class* Blob, but the docs
>> don't make it clear to me that this also implies export of the generator
>> function.
>>
>> So I'd add
>>
>> export(Blob)
>>
>> to your NAMESPACE. I just checked another package that exports a class,
>> and it separately exported the generator function, so I guess this is
>> known.
>>
>> Duncan Murdoch
>>
>>
>>
More information about the R-devel
mailing list