Dear useRs,
I am developing a package using RStudio and roxygen markup files. I have run
into a problem while checking.
The relevant function is a generic S3 statistical function modeled on t.test(),
with methods. It returns an object of class "htest" etc. Here Is the
(anonymized) relevant code:
<...>
#' @examples
#' foo(c(5,4,6,5,7,9,8,11,12,10), <other arguments>)
<...>
#' @export
foo <- function(x, ...) UseMethod("foo ")
#'
foo.default <- function(x, <other specific arguments>) {< code
adapted from t.test.default() >}
#'
foo.formula <- function(formula, data, subset, na.action, ...) {< code
adapted from t.test.formula() >)
The issue comes when checking. In RStudio I select the Check button in the
Build tab. It executes the command
devtools::check(cleanup = FALSE)
I attach the console output to demonstrate the error, as well as to perhaps see
any clues:
Updating <pkg> documentation
Loading <pkg>
Writing NAMESPACE
Writing <Rd files...>
Writing foo.Rd
Writing <Rd files...>
Setting env vars ---------------------------------------------------------------
CFLAGS : -Wall -pedantic
CXXFLAGS: -Wall -pedantic
Building <pkg>
---------------------------------------------------------------
"C:/PROGRA~1/R/R-32~1.4/bin/i386/R" --no-site-file --no-environ
--no-save \
--no-restore --quiet CMD build "C:\Users\szumiloj\R\<pkg>" \
--no-resave-data --no-manual
* checking for file 'C:\Users\szumiloj\R\<pkg>/DESCRIPTION' ... OK
* preparing '<pkg>':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* building '<pkg>_0.0.0.9001.tar.gz'
Setting env vars ---------------------------------------------------------------
_R_CHECK_CRAN_INCOMING_ : FALSE
_R_CHECK_FORCE_SUGGESTS_: FALSE
Checking <other arguments>)
---------------------------------------------------------------
"C:/PROGRA~1/R/R-32~1.4/bin/i386/R" --no-site-file --no-environ
--no-save \
--no-restore --quiet CMD check \
"C:\Users\szumiloj\AppData\Local\Temp\RtmpWKHu33/<pkg>_0.0.0.9001.tar.gz"
\
--as-cran --timings --no-manual
* using log directory 'C:/Users/szumiloj/R/<pkg>.Rcheck'
* using R version 3.2.4 (2016-03-10)
* using platform: i386-w64-mingw32 (32-bit)
* using session charset: ISO8859-1
* using options '--no-manual --as-cran'
* checking for file '<pkg>/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package '<pkg>' version '0.0.0.9001'
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking whether package '<pkg>' can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd line widths ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking examples ... ERROR
Running examples in '<pkg>-Ex.R' failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: foo
> ### Title: <foo title>
> ### Aliases: foo foo.default foo.formula <"Foo" etc>
>
> ### ** Examples
>
> foo(c(5,4,6,5,7,9,8,11,12,10), <other arguments>)
Error in UseMethod("foo") :
no applicable method for 'foo' applied to an object of class
"c('double', 'numeric')"
Calls: foo
Execution halted
* DONE
Status: 1 ERROR
See
'C:/Users/szumiloj/R/<pkg>.Rcheck/00check.log'
for details.
checking examples ... ERROR
Running examples in '<pkg>-Ex.R' failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: foo
> ### Title: <foo title>
> ### Aliases: foo foo.default foo.formula <"Foo" etc>
>
> ### ** Examples
>
> foo(c(5,4,6,5,7,9,8,11,12,10), <other arguments>)
Error in UseMethod("foo") :
no applicable method for 'foo' applied to an object of class
"c('double', 'numeric')"
Calls: foo
Execution halted
R CMD check results
1 error | 0 warnings | 0 notes
Warning messages:
1: `cleanup` is deprecated
2: @title [foo.R#1]: requires a value
3: @description [foo.R#1]: requires a value
4: @title [foo.R#1]: requires a value
5: @description [foo.R#1]: requires a value
R CMD check succeeded
It appears to me there is a dispatch problem, that the default method is not
being called. The issue persists even if I @export the default and formula
methods.
However, if I source() the whole file foo.Rd into the global environment, then
run the example foo(c(5,4,6,5,7,9,8,11,12,10), <other arguments>), it runs
just fine.
Any insight as to what is happening here? Also I do not understand the warnings
about @title and @description, as I certainly have those fields in the source
file. But this is not as critical.
Thanks in advance,
John Szumiloski
######## session info
> version
_
platform i386-w64-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 3
minor 2.4
year 2016
month 03
day 10
svn rev 70301
language R
version.string R version 3.2.4 (2016-03-10)
nickname Very Secure Dishes
> devtools::session_info()
Session info
--------------------------------------------------------------------------------
setting value
version R version 3.2.4 (2016-03-10)
system i386, mingw32
ui RStudio (0.99.893)
language (EN)
collate English_United States.1252
tz America/New_York
date 2016-04-12
Packages
------------------------------------------------------------------------------------
package * version date source
devtools * 1.11.0 2016-04-12 CRAN (R 3.2.4)
digest 0.6.9 2016-01-08 CRAN (R 3.2.3)
magrittr 1.5 2014-11-22 CRAN (R 3.2.0)
memoise 1.0.0 2016-01-29 CRAN (R 3.2.3)
Rcpp 0.12.4 2016-03-26 CRAN (R 3.2.4)
roxygen2 * 5.0.1 2015-11-11 CRAN (R 3.2.2)
stringi 1.0-1 2015-10-22 CRAN (R 3.2.2)
stringr 1.0.0 2015-04-30 CRAN (R 3.2.0)
withr 1.0.1 2016-02-04 CRAN (R 3.2.3)
John Szumiloski, Ph.D.
Senior Principal Scientist, Statistician
Analytical and Bioanalytical Operations<http://teams.bms.com/sites/ARD/>
NBR105-1-1411
Bristol-Myers Squibb
P.O. Box 191
1 Squibb Drive
New Brunswick, NJ
08903-0191
USA
(732) 227-7167
________________________________
This message (including any attachments) may contain con...{{dropped:11}}