[Rd] Strange behaviour of methods::slot() when returning a tibble

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Fri Jul 10 18:08:24 CEST 2020


I don't get any warning (but am using slightly different versions of 
everything than you are).

You can find where that message is coming from by running 
options(warn=2) first, which will convert it to an error.

Duncan Murdoch

On 10/07/2020 11:54 a.m., Stephen Martin Pederson wrote:
> I have an S4 object class defined in a Bioconductor package which contains multiple slots, some of which are tibbles, whilst others are vectors. If I call
> 
> slot(object, name)
> 
> where 'name' is an slot that contains a vector, everything works as expected. However, when I call slot(object, name) where 'name' is an slot that contains a tibble I get the following warning:
> 
> 
> Warning message:
> `...` is not empty.
> 
> We detected these problematic arguments:
> * `needs_dots`
> 
> These dots only exist to allow future extensions and should be empty.
> Did you misspecify an argument?
> Making 'packages.html' ... done
> 
> Wrapping the call in suppressWarnings() doesn't stop this, and this warning is printed every time the resultant object is called, e.g. df <- slot(object, name); df, would not print the error on the first call, but would print the warning every time df is  printed.
> 
> For an MWE
> 
> 
> setClass("track", slots = c(x="numeric", y="data.frame"))
> myTrack <- new("track", x = -4:4, y = tibble(y = 1))
> 
> myTrack
> 
> df <- slot(myTrack, "y")
> df
> 
> The package passes R CMD check even though this warning is produced in most examples. Changing to a generic S3 data.frame also doesn't produce this error. I'm running the following configuration:
> 
> 
> R version 4.0.2 (2020-06-22)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Ubuntu 18.04.4 LTS
> 
> Matrix products: default
> BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
> 
> locale:
>   [1] LC_CTYPE=en_AU.UTF-8       LC_NUMERIC=C               LC_TIME=en_AU.UTF-8
>   [4] LC_COLLATE=en_AU.UTF-8     LC_MONETARY=en_AU.UTF-8    LC_MESSAGES=en_AU.UTF-8
>   [7] LC_PAPER=en_AU.UTF-8       LC_NAME=C                  LC_ADDRESS=C
> [10] LC_TELEPHONE=C             LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C
> 
> attached base packages:
> [1] parallel  stats     graphics  grDevices utils     datasets  methods   base
> 
> other attached packages:
> [1] ngsReports_1.5.3    tibble_3.0.2        ggplot2_3.3.2       BiocGenerics_0.34.0
> 
> Thanks in advance,
> 
> Steve
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



More information about the R-devel mailing list