[R-pkg-devel] try() in R CMD check --as-cran

J C Nash pro|jcn@@h @end|ng |rom gm@||@com
Fri Jun 7 14:53:28 CEST 2019

Sorry reply not quicker. For some reason I'm not getting anything in the thread I started!
I found the responses in the archives. Perhaps cc: nashjc using uottawa.ca please.

I have prepared a tiny (2.8K) package at

R CMD check --> OK

R CMD check --as-cran --> 1 ERROR, 1 NOTE

The error is in an example:

> benbad<-function(x, y){
>    # y may be provided with different structures
>    f<-(x-y)^2
> } # very simple, but ...
> y<-1:10
> x<-c(1)
> cat("test benbad() with y=1:10, x=c(1)\n")
> tryfc01 <- try(fc01<-fchk(x, benbad, trace=3, y))
> print(tryfc01)
> print(fc01)

There's quite a lot of output, but it doesn't make much sense to me, as
it refers to code that I didn't write.

The function fchk is attempting to check if functions provided for
optimization do not violate some conditions e.g., character rather than
numeric etc.


On 2019-06-07 8:44 a.m., J C Nash wrote:
> Uwe Ligges ||gge@ @end|ng |rom @t using t|@t|k using tu-dortmund@de
> Fri Jun 7 11:44:37 CEST 2019
>     Previous message (by thread): [R-pkg-devel] try() in R CMD check --as-cran
>     Next message (by thread): [R-pkg-devel] using package data in package code
>     Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> Right, what problem are you talking about? Can you tell us which check
> it is and what it actually complained about.
> There is no check that looks at the sizes of x and y in exypressions
> such as
> (x - y)^2.
> as far as I know.
> Best,
> Uwe
> On 07.06.2019 10:33, Berry Boessenkool wrote:
>> Not entirely sure if this is what you're looking for:
>> https://github.com/wch/r-source/blob/trunk/src/library/tools/R/check.R
>> It does contain --as-cran a few times and there's the change-history:
>> https://github.com/wch/r-source/commits/trunk/src/library/tools/R/check.R
>> Regards,
>> Berry
>> ________________________________
>> From: R-package-devel <r-package-devel-bounces using r-project.org> on behalf of J C Nash <profjcnash using gmail.com>
>> Sent: Thursday, June 6, 2019 15:03
>> To: List r-package-devel
>> Subject: [R-pkg-devel] try() in R CMD check --as-cran
>> After making a small fix to my optimx package, I ran my usual R CMD check --as-cran.
>> To my surprise, I got two ERRORs unrelated to the change. The errors popped up in
>> a routine designed to check the call to the user objective function. In particular,
>> one check is that the size of vectors is the same in expressions like (x - y)^2.
>> This works fine with R CMD check, but the --as-cran seems to have changed and it
>> pops an error, even when the call is inside try(). The irony that the routine in
>> question is intended to avoid problems like this is not lost on me.
>> I'm working on a small reproducible example, but it's not small enough yet.
>> In the meantime, I'm looking for the source codes of the scripts for "R CMD check" and
>> "R CMD check --as-cran" so I can work out why there is this difference, which seems
>> to be recent.
>> Can someone send/post a link? I plan to figure this out and provide feedback,
>> as I suspect it is going to affect others. However, it may be a few days or even
>> weeks if past experience is a guide.
>> JN
>> ______________________________________________
>> R-package-devel using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>> 	[[alternative HTML version deleted]]
>> ______________________________________________
>> R-package-devel using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel

More information about the R-package-devel mailing list