[R-pkg-devel] failing S3 dispatch

Jens Oehlschlägel Jen@@Oeh|@ch|@ege| @end|ng |rom truec|u@ter@com
Tue Oct 19 21:43:46 CEST 2021


I didn't find an answer elsewhere:

My package 'bit' creates a S3 generic 'clone' and exports it. 
Furthermore it registers a S3 method 'clone.default' (not exported).

My package 'ff' imports package 'bit' and exports and registers a new S3 
method 'clone.ff'. However, calling 'clone(ffobj)' dispatches to 
clone.default instead of clone.ff !? Why?

What is the recommended way to create new S3-methods that get 
dispatched? In earlier versions of the packages I simply exported 
everything - that worked.

Best


Jens


 > require(ff)
 >
 > a <- as.ff(0:9)
 > class(x)
[1] "ff_vector" "ff"
 >
 > x <- clone(a)
 > y <- bit:::clone.default(a)
 > z <- clone.ff(a)
 >
 > # cloned ffobjects should have different filenames>

 > filename(a)  # original
[1] "/tmp/Rtmpk17JRZ/ff/clone1ed54cbb5060.ff"
 >
 > filename(x)  # unexpected equal (dispatch to clone.default)
[1] "/tmp/Rtmpk17JRZ/ff/clone1ed54cbb5060.ff"
 >
 > filename(y)  # expected equal
[1] "/tmp/Rtmpk17JRZ/ff/clone1ed54cbb5060.ff"
 >
 > filename(z)  # OK
[1] "/tmp/Rtmpk17JRZ/ff/clone1ed551d3ee66.ff"

 > version
                _
platform       x86_64-pc-linux-gnu
arch           x86_64
os             linux-gnu
system         x86_64, linux-gnu
status
major          4
minor          1.1
year           2021
month          08
day            10
svn rev        80725
language       R
version.string R version 4.1.1 (2021-08-10)
nickname       Kick Things



More information about the R-package-devel mailing list