Re: [R-pkg-devel] checks on CRAN notes 'examples_i386', but checks elsewhere do not

2019-06-07 Thread Georgi Boshnakov
It looks like you get the note when you run the check on the package directory, 
rather than on the tarball of the package. Undoubtedly, you submitted the 
tarball towinbuilder. develops::check also first builds the package and then 
does the flecks on the tarball.

If unwanted files do creep into the tarball, use file.Rbuildignore to tell the 
builder not to include them.


 Georgi Boshnakov 



From: R-package-devel [r-package-devel-boun...@r-project.org] on behalf of 
Kassel Hingee [kassel.hin...@research.uwa.edu.au]
Sent: 07 June 2019 05:35
To: r-package-devel@r-project.org
Subject: [R-pkg-devel] checks on CRAN notes 'examples_i386', but checks 
elsewhere do not

Hi All,

This is my first time submitting a package to CRAN, and posting here. I
hope I get everything right.

Checks ran by CRAN for Windows systems generated a note that I don't know
where to start to solve:

* checking for non-standard things in the check directory ... NOTE
Found the following files/directories:
  examples_i386 examples_x64 lacunaritycovariance-Ex_i386.Rout
  lacunaritycovariance-Ex_x64.Rout tests_i386 tests_x64


This note was not generated when I uploaded the package directly to
winbuilder in either release or development versions of R.
It also wasn't generated when I ran devtools::check() on my own (unix) computer.

The results of the CRAN check can be seen here for another few days:
https://win-builder.r-project.org/incoming_pretest/lacunaritycovariance_1.0-3_20190606_051128/
The check log containing the above note is here:
https://win-builder.r-project.org/incoming_pretest/lacunaritycovariance_1.0-3_20190606_051128/Windows/00check.log
The package source can bee seen here:
https://github.com/kasselhingee/lacunaritycovariance/tree/release

I haven't noticed a solution discussed earlier on this email list and
web searching gave me no joy. I am hoping you can help!

yours
Kassel

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] checks on CRAN notes 'examples_i386', but checks elsewhere do not

2019-06-07 Thread Uwe Ligges
Or you have been there at the wrong time when we enabled a new check 
that was not able to correctly deal with check directories produced 
under bi-arch check siutuations. This is fixed for wionbuilder and wil 
be fixed in the R sources soon,

Uwe



On 07.06.2019 09:31, Georgi Boshnakov wrote:

It looks like you get the note when you run the check on the package directory, 
rather than on the tarball of the package. Undoubtedly, you submitted the 
tarball towinbuilder. develops::check also first builds the package and then 
does the flecks on the tarball.

If unwanted files do creep into the tarball, use file.Rbuildignore to tell the 
builder not to include them.


  Georgi Boshnakov



From: R-package-devel [r-package-devel-boun...@r-project.org] on behalf of 
Kassel Hingee [kassel.hin...@research.uwa.edu.au]
Sent: 07 June 2019 05:35
To: r-package-devel@r-project.org
Subject: [R-pkg-devel] checks on CRAN notes 'examples_i386', but checks 
elsewhere do not

Hi All,

This is my first time submitting a package to CRAN, and posting here. I
hope I get everything right.

Checks ran by CRAN for Windows systems generated a note that I don't know
where to start to solve:

* checking for non-standard things in the check directory ... NOTE
Found the following files/directories:
   examples_i386 examples_x64 lacunaritycovariance-Ex_i386.Rout
   lacunaritycovariance-Ex_x64.Rout tests_i386 tests_x64


This note was not generated when I uploaded the package directly to
winbuilder in either release or development versions of R.
It also wasn't generated when I ran devtools::check() on my own (unix) computer.

The results of the CRAN check can be seen here for another few days:
https://win-builder.r-project.org/incoming_pretest/lacunaritycovariance_1.0-3_20190606_051128/
The check log containing the above note is here:
https://win-builder.r-project.org/incoming_pretest/lacunaritycovariance_1.0-3_20190606_051128/Windows/00check.log
The package source can bee seen here:
https://github.com/kasselhingee/lacunaritycovariance/tree/release

I haven't noticed a solution discussed earlier on this email list and
web searching gave me no joy. I am hoping you can help!

yours
Kassel

 [[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel



__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2019-06-07 Thread Uwe Ligges
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  on behalf of J C Nash 

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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel



__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] using package data in package code

2019-06-07 Thread Linus Chen
Dear Duncan,

Thank you very much!

>
> For data, the sysdata.rda file is the easiest solution.  It's for data
> that is used by the functions in the package, not user-visible.  Just
> put x into that file in the package/R directory to make use of it.
>
> You don't need a two-pass solution.  As long as the sysdata.rda file
> stays unmodified, x will be available for code in the package to use as
> it sees fit, without any special handling.  (If x is created from
> complicated source code that changes regularly, I'd go with one of my
> earlier suggestions.)
>

This is exactly the approach I tried first. In my naive mind, this
looks to be the most
natural way, and I thought it SHOULD work. However, it did not work on
my computer...,
and that is why I started to invent ugly work-arounds...

Please see attached a minimal example to reproduce the error message:
object 'x' not found.

Thank you very much!
Lei


test.tgz
Description: GNU Zip compressed data
__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2019-06-07 Thread J C Nash
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: nas...@uottawa.ca please.

I have prepared a tiny (2.8K) package at
http://web.ncf.ca/nashjc/jfiles/fchk_2019-6.5.tar.gz

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.

JN


On 2019-06-07 8:44 a.m., J C Nash wrote:
> Uwe Ligges ||gge@ @end|ng |rom @t@t|@t|k@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  on 
>> behalf of J C Nash 
>> 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
>>
>

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2019-06-07 Thread Sebastian Meyer
The failure stated in the R CMD check failure report is:

>  --- failure: length > 1 in coercion to logical ---

This comes from --as-cran performing useful extra checks via setting the
environment variable _R_CHECK_LENGTH_1_LOGIC2_, which means:

> check if either argument of the binary operators && and || has length greater 
> than one. 

(see https://cran.r-project.org/doc/manuals/r-release/R-ints.html#Tools)

The failure report also states the source of the failure:

>  --- call from context --- 
> fchk(x, benbad, trace = 3, y)
>  --- call from argument --- 
> is.infinite(fval) || is.na(fval)

The problem is that both is.infinite(fval) and is.na(fval) return
vectors of length 10 in your test case:

>  --- value of length: 10 type: logical ---
>  [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE

The || operator works on length 1 Booleans. Since fval can be of length
greater than 1 at that point, the proper condition seems to be:

any(is.infinite(fval)) || any(is.na(fval))

Best regards,

Sebastian


Am 07.06.19 um 14:53 schrieb J C Nash:
> 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: nas...@uottawa.ca please.
> 
> I have prepared a tiny (2.8K) package at
> http://web.ncf.ca/nashjc/jfiles/fchk_2019-6.5.tar.gz
> 
> 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.
> 
> JN
> 
> 
> On 2019-06-07 8:44 a.m., J C Nash wrote:
>> Uwe Ligges ||gge@ @end|ng |rom @t@t|@t|k@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  on 
>>> behalf of J C Nash 
>>> 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
>>>
>>
> 
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

___

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

2019-06-07 Thread J C Nash
Should try() not stop those checks from forcing an error?

I recognize that this is the failure -- it is indeed the check I'm trying to
catch -- but I don't want tests of such checks to fail my package.

JN

On 2019-06-07 9:31 a.m., Sebastian Meyer wrote:
> The failure stated in the R CMD check failure report is:
> 
>>  --- failure: length > 1 in coercion to logical ---
> 
> This comes from --as-cran performing useful extra checks via setting the
> environment variable _R_CHECK_LENGTH_1_LOGIC2_, which means:
> 
>> check if either argument of the binary operators && and || has length 
>> greater than one. 
> 
> (see https://cran.r-project.org/doc/manuals/r-release/R-ints.html#Tools)
> 
> The failure report also states the source of the failure:
> 
>>  --- call from context --- 
>> fchk(x, benbad, trace = 3, y)
>>  --- call from argument --- 
>> is.infinite(fval) || is.na(fval)
> 
> The problem is that both is.infinite(fval) and is.na(fval) return
> vectors of length 10 in your test case:
> 
>>  --- value of length: 10 type: logical ---
>>  [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
> 
> The || operator works on length 1 Booleans. Since fval can be of length
> greater than 1 at that point, the proper condition seems to be:
> 
> any(is.infinite(fval)) || any(is.na(fval))
> 
> Best regards,
> 
>   Sebastian
> 
> 
> Am 07.06.19 um 14:53 schrieb J C Nash:
>> 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: nas...@uottawa.ca please.
>>
>> I have prepared a tiny (2.8K) package at
>> http://web.ncf.ca/nashjc/jfiles/fchk_2019-6.5.tar.gz
>>
>> 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.
>>
>> JN
>>
>>
>> On 2019-06-07 8:44 a.m., J C Nash wrote:
>>> Uwe Ligges ||gge@ @end|ng |rom @t@t|@t|k@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  on 
 behalf of J C Nash 
 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-de

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

2019-06-07 Thread Serguei Sokol

On 07/06/2019 14:53, J C Nash wrote:

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: nas...@uottawa.ca please.

I have prepared a tiny (2.8K) package at
http://web.ncf.ca/nashjc/jfiles/fchk_2019-6.5.tar.gz

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)

The faulty line in fchk() seems to be

if (is.infinite(fval) || is.na(fval)) { ... }

As fval is now allowed to be a vector, it conflicts with '||' operator 
which, as you know, expects scalar logical values. If you replace this 
line with something like:


if (any(is.infinite(fval) | is.na(fval))) { ... }
is gone even with --as-cran option used. In my opinion (even if nobody 
asks for it ;) ), it is fortunate that this option is picky enough about 
such kind of misuse of logical operators.


Best,
Serguei.


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.

JN


On 2019-06-07 8:44 a.m., J C Nash wrote:

Uwe Ligges ||gge@ @end|ng |rom @t@t|@t|k@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  on behalf of J C 
Nash 
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





__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel



__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2019-06-07 Thread Serguei Sokol

On 07/06/2019 15:31, Sebastian Meyer wrote:

The failure stated in the R CMD check failure report is:


  --- failure: length > 1 in coercion to logical ---


This comes from --as-cran performing useful extra checks via setting the
environment variable _R_CHECK_LENGTH_1_LOGIC2_, which means:


check if either argument of the binary operators && and || has length greater 
than one.


(see https://cran.r-project.org/doc/manuals/r-release/R-ints.html#Tools)

The failure report also states the source of the failure:


  --- call from context ---
fchk(x, benbad, trace = 3, y)
  --- call from argument ---
is.infinite(fval) || is.na(fval)


The problem is that both is.infinite(fval) and is.na(fval) return
vectors of length 10 in your test case:


  --- value of length: 10 type: logical ---
  [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE


The || operator works on length 1 Booleans. Since fval can be of length
greater than 1 at that point, the proper condition seems to be:

any(is.infinite(fval)) || any(is.na(fval))

a little typo here: it should be '|', not '||', right ?

Best,
Serguei.


Am 07.06.19 um 14:53 schrieb J C Nash:

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: nas...@uottawa.ca please.

I have prepared a tiny (2.8K) package at
http://web.ncf.ca/nashjc/jfiles/fchk_2019-6.5.tar.gz

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.

JN


On 2019-06-07 8:44 a.m., J C Nash wrote:

Uwe Ligges ||gge@ @end|ng |rom @t@t|@t|k@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  on behalf of J C 
Nash 
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





__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel



__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel



__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2019-06-07 Thread Jeff Newmiller
>> any(is.infinite(fval)) || any(is.na(fval))
>
>a little typo here: it should be '|', not '||', right ?

Since `any` collapses the vectors to length 1 either will work, but I would 
prefer `||`.

On June 7, 2019 6:51:29 AM PDT, Serguei Sokol  wrote:
>On 07/06/2019 15:31, Sebastian Meyer wrote:
>> The failure stated in the R CMD check failure report is:
>> 
>>>   --- failure: length > 1 in coercion to logical ---
>> 
>> This comes from --as-cran performing useful extra checks via setting
>the
>> environment variable _R_CHECK_LENGTH_1_LOGIC2_, which means:
>> 
>>> check if either argument of the binary operators && and || has
>length greater than one.
>> 
>> (see
>https://cran.r-project.org/doc/manuals/r-release/R-ints.html#Tools)
>> 
>> The failure report also states the source of the failure:
>> 
>>>   --- call from context ---
>>> fchk(x, benbad, trace = 3, y)
>>>   --- call from argument ---
>>> is.infinite(fval) || is.na(fval)
>> 
>> The problem is that both is.infinite(fval) and is.na(fval) return
>> vectors of length 10 in your test case:
>> 
>>>   --- value of length: 10 type: logical ---
>>>   [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
>> 
>> The || operator works on length 1 Booleans. Since fval can be of
>length
>> greater than 1 at that point, the proper condition seems to be:
>> 
>> any(is.infinite(fval)) || any(is.na(fval))
>a little typo here: it should be '|', not '||', right ?
>
>Best,
>Serguei.
>
>> Am 07.06.19 um 14:53 schrieb J C Nash:
>>> 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: nas...@uottawa.ca
>please.
>>>
>>> I have prepared a tiny (2.8K) package at
>>> http://web.ncf.ca/nashjc/jfiles/fchk_2019-6.5.tar.gz
>>>
>>> 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.
>>>
>>> JN
>>>
>>>
>>> On 2019-06-07 8:44 a.m., J C Nash wrote:
 Uwe Ligges ||gge@ @end|ng |rom @t@t|@t|k@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-project.org> on behalf of J C Nash 
> 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
>
> _

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

2019-06-07 Thread Serguei Sokol

On 07/06/2019 16:05, Jeff Newmiller wrote:

any(is.infinite(fval)) || any(is.na(fval))


a little typo here: it should be '|', not '||', right ?


Since `any` collapses the vectors to length 1 either will work, but I would 
prefer `||`.
You are right, I missed the second 'any()' at the first glance. I read 
it as 'any(v1 || v2)'. My bad.




On June 7, 2019 6:51:29 AM PDT, Serguei Sokol  wrote:

On 07/06/2019 15:31, Sebastian Meyer wrote:

The failure stated in the R CMD check failure report is:


   --- failure: length > 1 in coercion to logical ---


This comes from --as-cran performing useful extra checks via setting

the

environment variable _R_CHECK_LENGTH_1_LOGIC2_, which means:


check if either argument of the binary operators && and || has

length greater than one.


(see

https://cran.r-project.org/doc/manuals/r-release/R-ints.html#Tools)


The failure report also states the source of the failure:


   --- call from context ---
fchk(x, benbad, trace = 3, y)
   --- call from argument ---
is.infinite(fval) || is.na(fval)


The problem is that both is.infinite(fval) and is.na(fval) return
vectors of length 10 in your test case:


   --- value of length: 10 type: logical ---
   [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE


The || operator works on length 1 Booleans. Since fval can be of

length

greater than 1 at that point, the proper condition seems to be:

any(is.infinite(fval)) || any(is.na(fval))

a little typo here: it should be '|', not '||', right ?

Best,
Serguei.


Am 07.06.19 um 14:53 schrieb J C Nash:

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: nas...@uottawa.ca

please.


I have prepared a tiny (2.8K) package at
http://web.ncf.ca/nashjc/jfiles/fchk_2019-6.5.tar.gz

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.

JN


On 2019-06-07 8:44 a.m., J C Nash wrote:

Uwe Ligges ||gge@ @end|ng |rom @t@t|@t|k@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-project.org> on behalf of J C Nash 

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-pa

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

2019-06-07 Thread J C Nash
Serguei picked up the glitch and Jeff sorted out the || vs | once any()
was used.

The test that caused the issue was not the one I was looking for,
but another case. However, I'd overlooked the possibility that
there could be different lengths, so || complained (as it should,
but didn't in regular R CMD check).

As an aside, the --as-cran check complains as follows:

The The Title field should be in title case. Current version is:
‘A test of R CMD check --as-cran’
In title case that is:
‘A Test of R CMD Check --as-Cran’

Thanks to all.

JN


On 2019-06-07 10:05 a.m., Jeff Newmiller wrote:
>>> any(is.infinite(fval)) || any(is.na(fval))
>>
>> a little typo here: it should be '|', not '||', right ?
> 
> Since `any` collapses the vectors to length 1 either will work, but I would 
> prefer `||`.
> 
> On June 7, 2019 6:51:29 AM PDT, Serguei Sokol  wrote:
>> On 07/06/2019 15:31, Sebastian Meyer wrote:
>>> The failure stated in the R CMD check failure report is:
>>>
   --- failure: length > 1 in coercion to logical ---
>>>
>>> This comes from --as-cran performing useful extra checks via setting
>> the
>>> environment variable _R_CHECK_LENGTH_1_LOGIC2_, which means:
>>>
 check if either argument of the binary operators && and || has
>> length greater than one.
>>>
>>> (see
>> https://cran.r-project.org/doc/manuals/r-release/R-ints.html#Tools)
>>>
>>> The failure report also states the source of the failure:
>>>
   --- call from context ---
 fchk(x, benbad, trace = 3, y)
   --- call from argument ---
 is.infinite(fval) || is.na(fval)
>>>
>>> The problem is that both is.infinite(fval) and is.na(fval) return
>>> vectors of length 10 in your test case:
>>>
   --- value of length: 10 type: logical ---
   [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
>>>
>>> The || operator works on length 1 Booleans. Since fval can be of
>> length
>>> greater than 1 at that point, the proper condition seems to be:
>>>
>>> any(is.infinite(fval)) || any(is.na(fval))
>> a little typo here: it should be '|', not '||', right ?
>>
>> Best,
>> Serguei.
>>
>>> Am 07.06.19 um 14:53 schrieb J C Nash:
 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: nas...@uottawa.ca
>> please.

 I have prepared a tiny (2.8K) package at
 http://web.ncf.ca/nashjc/jfiles/fchk_2019-6.5.tar.gz

 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.

 JN


 On 2019-06-07 8:44 a.m., J C Nash wrote:
> Uwe Ligges ||gge@ @end|ng |rom @t@t|@t|k@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-project.org> on behalf of J C Nash 
>> 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, 

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

2019-06-07 Thread Duncan Murdoch

On 07/06/2019 9:46 a.m., J C Nash wrote:

Should try() not stop those checks from forcing an error?


try(stop("msg"))  will print the error message, but won't stop 
execution.  Presumably the printed message is what is causing you 
problems.  If you want to suppress that, use


try(stop("msg"), silent = TRUE)

Duncan Murdoch



I recognize that this is the failure -- it is indeed the check I'm trying to
catch -- but I don't want tests of such checks to fail my package.

JN

On 2019-06-07 9:31 a.m., Sebastian Meyer wrote:

The failure stated in the R CMD check failure report is:


  --- failure: length > 1 in coercion to logical ---


This comes from --as-cran performing useful extra checks via setting the
environment variable _R_CHECK_LENGTH_1_LOGIC2_, which means:


check if either argument of the binary operators && and || has length greater 
than one.


(see https://cran.r-project.org/doc/manuals/r-release/R-ints.html#Tools)

The failure report also states the source of the failure:


  --- call from context ---
fchk(x, benbad, trace = 3, y)
  --- call from argument ---
is.infinite(fval) || is.na(fval)


The problem is that both is.infinite(fval) and is.na(fval) return
vectors of length 10 in your test case:


  --- value of length: 10 type: logical ---
  [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE


The || operator works on length 1 Booleans. Since fval can be of length
greater than 1 at that point, the proper condition seems to be:

any(is.infinite(fval)) || any(is.na(fval))

Best regards,

Sebastian


Am 07.06.19 um 14:53 schrieb J C Nash:

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: nas...@uottawa.ca please.

I have prepared a tiny (2.8K) package at
http://web.ncf.ca/nashjc/jfiles/fchk_2019-6.5.tar.gz

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.

JN


On 2019-06-07 8:44 a.m., J C Nash wrote:

Uwe Ligges ||gge@ @end|ng |rom @t@t|@t|k@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  on behalf of J C 
Nash 
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





__

[R-pkg-devel] Travis/appveyor with CXX14/17

2019-06-07 Thread Tim Keitt
I bumped a package to CXX14/17 and it failed on Travis/Appveyor while
checking fine locally. I assume I need to request different compilers or
something like that. Anyone have a quick recipe for that?

THK

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2019-06-07 Thread Serguei Sokol

On 07/06/2019 16:47, Duncan Murdoch wrote:

On 07/06/2019 9:46 a.m., J C Nash wrote:

Should try() not stop those checks from forcing an error?


try(stop("msg"))  will print the error message, but won't stop 
execution.  Presumably the printed message is what is causing you 
problems.  If you want to suppress that, use


try(stop("msg"), silent = TRUE)
By curiosity, I tried but to no avail. Moreover, I have tried to trigger 
a similar error in different place by adding to the John's example in 
man/fchk.Rd the following code:


#... the same before
} # very simple, but ...

print(Sys.getenv("_R_CHECK_LENGTH_1_LOGIC2_", unset="unset"))
a=1:3 || 1:3
cat("a=", a, "\n")
y<-1:10
#... the same after.

add failed again. This part of code works without any error signaling 
while fchk()'s situation continue to flag up an error. From 
fchk-Ex.Rout, we can see:

...
+ } # very simple, but ...
>
> print(Sys.getenv("_R_CHECK_LENGTH_1_LOGIC2_", unset="unset"))
[1] "package:_R_CHECK_PACKAGE_NAME_,abort,verbose"
> a=1:3 || 1:3
> cat("a=", a, "\n")
a= TRUE
> y<-1:10
...
Function evaluation returns a vector not a scalar
 --- FAILURE REPORT --
 --- failure: length > 1 in coercion to logical ---
...

While in regular R session:
> Sys.unsetenv("_R_CHECK_LENGTH_1_LOGIC2_")
> (a=1:3 || 1:3)
[1] TRUE
> Sys.setenv("_R_CHECK_LENGTH_1_LOGIC2_"="")
> (a=1:3 || 1:3)
Error in 1:3 || 1:3 : 'length(x) = 3 > 1' in coercion to 'logical(1)'

So, to my mind, 'a=1:3 || 1:3' should be considered as an error in a 
check with "--as-cran" but for some reason is not.


Both fchk with modified example and corresponding fchk-Ex.Rout are enclosed.

Best,
Serguei.



Duncan Murdoch



I recognize that this is the failure -- it is indeed the check I'm 
trying to

catch -- but I don't want tests of such checks to fail my package.

JN

On 2019-06-07 9:31 a.m., Sebastian Meyer wrote:

The failure stated in the R CMD check failure report is:


  --- failure: length > 1 in coercion to logical ---


This comes from --as-cran performing useful extra checks via setting the
environment variable _R_CHECK_LENGTH_1_LOGIC2_, which means:

check if either argument of the binary operators && and || has 
length greater than one.


(see https://cran.r-project.org/doc/manuals/r-release/R-ints.html#Tools)

The failure report also states the source of the failure:


  --- call from context ---
fchk(x, benbad, trace = 3, y)
  --- call from argument ---
is.infinite(fval) || is.na(fval)


The problem is that both is.infinite(fval) and is.na(fval) return
vectors of length 10 in your test case:


  --- value of length: 10 type: logical ---
  [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE


The || operator works on length 1 Booleans. Since fval can be of length
greater than 1 at that point, the proper condition seems to be:

any(is.infinite(fval)) || any(is.na(fval))

Best regards,

Sebastian


Am 07.06.19 um 14:53 schrieb J C Nash:
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: nas...@uottawa.ca 
please.


I have prepared a tiny (2.8K) package at
http://web.ncf.ca/nashjc/jfiles/fchk_2019-6.5.tar.gz

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.

JN


On 2019-06-07 8:44 a.m., J C Nash wrote:

Uwe Ligges ||gge@ @end|ng |rom @t@t|@t|k@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-project.org> on behalf of J C Nash 

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 

Re: [R-pkg-devel] Travis/appveyor with CXX14/17

2019-06-07 Thread Dirk Eddelbuettel


On 7 June 2019 at 10:13, Tim Keitt wrote:
| I bumped a package to CXX14/17 and it failed on Travis/Appveyor while
| checking fine locally. I assume I need to request different compilers or

Correct.

Working with a seriously outdated base layer of Ubuntu is a key bug^Hfeature
of Travis.  Maddening, really.

| something like that. Anyone have a quick recipe for that?

Yes.  In fact, two different ways.

i)  If you use the old Travis set up which is more shell-script alike, then
one way is to use a PPA for nighlies/more current gcc or clang
versions. I used to do that some client packages that needed newer
compilers. An older example is still here

https://github.com/eddelbuettel/cpptoml/blob/master/.travis.yml

ii) Screw Travis and use the fact that you can now bring your own Docker
container.  That is much preferable as you are in _complete_ control of
the test environment. I switched a few packages to this, particularly
when they needed additional libraries which I was building / providing
via a PPA anyway. Two examples:

  https://github.com/eddelbuettel/rquantlib/blob/master/.travis.yml
  https://github.com/rcppmlpack/rcppmlpack2/blob/master/.travis.yml

If you don't need extra libraries then something like this container have
R, recent toolchain and support for PPAs. I have been meaning to blog
about it with an example:

  https://hub.docker.com/r/rocker/r-apt

Obviously you can also start from vanilla Rocker's r-base, or any other
Debian container.  Again,  your control, possibly also your initial work.

A scheme I found helpful in a few repos is to create

  docker/ci/Dockerfile -- base layer for CI, used by Travis
  docker/run/Dockerfile-- above plus the actual repo code

where the latter one is a simple container for users of the package.

Hth, Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2019-06-07 Thread William Dunlap
The length-condition-not-equal-to-one checks will cause R to shutdown even
if the code in a tryCatch().

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Fri, Jun 7, 2019 at 7:47 AM Duncan Murdoch 
wrote:

> On 07/06/2019 9:46 a.m., J C Nash wrote:
> > Should try() not stop those checks from forcing an error?
>
> try(stop("msg"))  will print the error message, but won't stop
> execution.  Presumably the printed message is what is causing you
> problems.  If you want to suppress that, use
>
> try(stop("msg"), silent = TRUE)
>
> Duncan Murdoch
>
> >
> > I recognize that this is the failure -- it is indeed the check I'm
> trying to
> > catch -- but I don't want tests of such checks to fail my package.
> >
> > JN
> >
> > On 2019-06-07 9:31 a.m., Sebastian Meyer wrote:
> >> The failure stated in the R CMD check failure report is:
> >>
> >>>   --- failure: length > 1 in coercion to logical ---
> >>
> >> This comes from --as-cran performing useful extra checks via setting the
> >> environment variable _R_CHECK_LENGTH_1_LOGIC2_, which means:
> >>
> >>> check if either argument of the binary operators && and || has length
> greater than one.
> >>
> >> (see https://cran.r-project.org/doc/manuals/r-release/R-ints.html#Tools
> )
> >>
> >> The failure report also states the source of the failure:
> >>
> >>>   --- call from context ---
> >>> fchk(x, benbad, trace = 3, y)
> >>>   --- call from argument ---
> >>> is.infinite(fval) || is.na(fval)
> >>
> >> The problem is that both is.infinite(fval) and is.na(fval) return
> >> vectors of length 10 in your test case:
> >>
> >>>   --- value of length: 10 type: logical ---
> >>>   [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
> >>
> >> The || operator works on length 1 Booleans. Since fval can be of length
> >> greater than 1 at that point, the proper condition seems to be:
> >>
> >> any(is.infinite(fval)) || any(is.na(fval))
> >>
> >> Best regards,
> >>
> >>  Sebastian
> >>
> >>
> >> Am 07.06.19 um 14:53 schrieb J C Nash:
> >>> 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: nas...@uottawa.ca
> please.
> >>>
> >>> I have prepared a tiny (2.8K) package at
> >>> http://web.ncf.ca/nashjc/jfiles/fchk_2019-6.5.tar.gz
> >>>
> >>> 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.
> >>>
> >>> JN
> >>>
> >>>
> >>> On 2019-06-07 8:44 a.m., J C Nash wrote:
>  Uwe Ligges ||gge@ @end|ng |rom @t@t|@t|k@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 
> on behalf of J C Nash 
> > 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 t

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

2019-06-07 Thread Duncan Murdoch

On 07/06/2019 12:32 p.m., William Dunlap wrote:
The length-condition-not-equal-to-one checks will cause R to shutdown 
even if the code in a tryCatch().


That's strange.  I'm unable to reproduce it with my tries, and John's 
package is no longer online.  Do you have an example I could look at?


Duncan Murdoch



Bill Dunlap
TIBCO Software
wdunlap tibco.com 


On Fri, Jun 7, 2019 at 7:47 AM Duncan Murdoch > wrote:


On 07/06/2019 9:46 a.m., J C Nash wrote:
 > Should try() not stop those checks from forcing an error?

try(stop("msg"))  will print the error message, but won't stop
execution.  Presumably the printed message is what is causing you
problems.  If you want to suppress that, use

try(stop("msg"), silent = TRUE)

Duncan Murdoch

 >
 > I recognize that this is the failure -- it is indeed the check
I'm trying to
 > catch -- but I don't want tests of such checks to fail my package.
 >
 > JN
 >
 > On 2019-06-07 9:31 a.m., Sebastian Meyer wrote:
 >> The failure stated in the R CMD check failure report is:
 >>
 >>>   --- failure: length > 1 in coercion to logical ---
 >>
 >> This comes from --as-cran performing useful extra checks via
setting the
 >> environment variable _R_CHECK_LENGTH_1_LOGIC2_, which means:
 >>
 >>> check if either argument of the binary operators && and || has
length greater than one.
 >>
 >> (see
https://cran.r-project.org/doc/manuals/r-release/R-ints.html#Tools)
 >>
 >> The failure report also states the source of the failure:
 >>
 >>>   --- call from context ---
 >>> fchk(x, benbad, trace = 3, y)
 >>>   --- call from argument ---
 >>> is.infinite(fval) || is.na (fval)
 >>
 >> The problem is that both is.infinite(fval) and is.na
(fval) return
 >> vectors of length 10 in your test case:
 >>
 >>>   --- value of length: 10 type: logical ---
 >>>   [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 >>
 >> The || operator works on length 1 Booleans. Since fval can be of
length
 >> greater than 1 at that point, the proper condition seems to be:
 >>
 >> any(is.infinite(fval)) || any(is.na (fval))
 >>
 >> Best regards,
 >>
 >>      Sebastian
 >>
 >>
 >> Am 07.06.19 um 14:53 schrieb J C Nash:
 >>> 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:
nas...@uottawa.ca  please.
 >>>
 >>> I have prepared a tiny (2.8K) package at
 >>> http://web.ncf.ca/nashjc/jfiles/fchk_2019-6.5.tar.gz
 >>>
 >>> 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.
 >>>
 >>> JN
 >>>
 >>>
 >>> On 2019-06-07 8:44 a.m., J C Nash wrote:
  Uwe Ligges ||gge@ @end|ng |rom @t@t|@t|k@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
 >
 >
 > 
 >

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

2019-06-07 Thread Henrik Bengtsson
Duncan and others, see one of Serguei comments above.  Specifically,
`R CMD check --as-cran` will set

  _R_CHECK_LENGTH_1_LOGIC2_="package:_R_CHECK_PACKAGE_NAME_,abort,verbose"

which will (i) check those coding mistakes only in the package that is
checked but not any of its dependencies, (ii) it will abort R on such
errors, and (iii) print verbose output.  I think this type of R CMD
check behavior only exists for '_R_CHECK_LENGTH_1_LOGIC2_' checks.
This is in contrast to:

  _R_CHECK_LENGTH_1_LOGIC2_=TRUE

which will produce an ordinary error condition that can be captured.

Example:

Sys.setenv("_R_CHECK_LENGTH_1_LOGIC2_" = "TRUE")
res <- tryCatch(c(TRUE, TRUE) && FALSE, error = identity)
str(res)
## List of 2
##  $ message: chr "'length(x) = 2 > 1' in coercion to 'logical(1)'"
##  $ call   : language c(TRUE, TRUE) && FALSE
##  - attr(*, "class")= chr [1:3] "simpleError" "error" "condition"


Sys.setenv("_R_CHECK_LENGTH_1_LOGIC2_" = "abort,verbose")
res <- tryCatch(c(TRUE, TRUE) && FALSE, error = identity)

 --- FAILURE REPORT --
 --- failure: length > 1 in coercion to logical ---
 --- srcref ---
:
 --- package (from environment) ---
package:stats
 --- call from context ---
doTryCatch(return(expr), name, parentenv, handler)
 --- call from argument ---
c(TRUE, TRUE) && FALSE
 --- R stacktrace ---
where 1: doTryCatch(return(expr), name, parentenv, handler)
where 2: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 3: tryCatchList(expr, classes, parentenv, handlers)
where 4: tryCatch(c(TRUE, TRUE) && FALSE, error = identity)

 --- value of length: 2 type: logical ---
[1] TRUE TRUE
 --- function from context ---
function (expr, name, parentenv, handler)
{
.Internal(.addCondHands(name, list(handler), parentenv, environment(),
FALSE))
expr
}


 --- function search by body ---
 --- END OF FAILURE REPORT --
Fatal error: length > 1 in coercion to logical

[here R terminates]

/Henrik

On Fri, Jun 7, 2019 at 10:26 AM Duncan Murdoch  wrote:
>
> On 07/06/2019 12:32 p.m., William Dunlap wrote:
> > The length-condition-not-equal-to-one checks will cause R to shutdown
> > even if the code in a tryCatch().
>
> That's strange.  I'm unable to reproduce it with my tries, and John's
> package is no longer online.  Do you have an example I could look at?
>
> Duncan Murdoch
>
> >
> > Bill Dunlap
> > TIBCO Software
> > wdunlap tibco.com 
> >
> >
> > On Fri, Jun 7, 2019 at 7:47 AM Duncan Murdoch  > > wrote:
> >
> > On 07/06/2019 9:46 a.m., J C Nash wrote:
> >  > Should try() not stop those checks from forcing an error?
> >
> > try(stop("msg"))  will print the error message, but won't stop
> > execution.  Presumably the printed message is what is causing you
> > problems.  If you want to suppress that, use
> >
> > try(stop("msg"), silent = TRUE)
> >
> > Duncan Murdoch
> >
> >  >
> >  > I recognize that this is the failure -- it is indeed the check
> > I'm trying to
> >  > catch -- but I don't want tests of such checks to fail my package.
> >  >
> >  > JN
> >  >
> >  > On 2019-06-07 9:31 a.m., Sebastian Meyer wrote:
> >  >> The failure stated in the R CMD check failure report is:
> >  >>
> >  >>>   --- failure: length > 1 in coercion to logical ---
> >  >>
> >  >> This comes from --as-cran performing useful extra checks via
> > setting the
> >  >> environment variable _R_CHECK_LENGTH_1_LOGIC2_, which means:
> >  >>
> >  >>> check if either argument of the binary operators && and || has
> > length greater than one.
> >  >>
> >  >> (see
> > https://cran.r-project.org/doc/manuals/r-release/R-ints.html#Tools)
> >  >>
> >  >> The failure report also states the source of the failure:
> >  >>
> >  >>>   --- call from context ---
> >  >>> fchk(x, benbad, trace = 3, y)
> >  >>>   --- call from argument ---
> >  >>> is.infinite(fval) || is.na (fval)
> >  >>
> >  >> The problem is that both is.infinite(fval) and is.na
> > (fval) return
> >  >> vectors of length 10 in your test case:
> >  >>
> >  >>>   --- value of length: 10 type: logical ---
> >  >>>   [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
> >  >>
> >  >> The || operator works on length 1 Booleans. Since fval can be of
> > length
> >  >> greater than 1 at that point, the proper condition seems to be:
> >  >>
> >  >> any(is.infinite(fval)) || any(is.na (fval))
> >  >>
> >  >> Best regards,
> >  >>
> >  >>  Sebastian
> >  >>
> >  >>
> >  >> Am 07.06.19 um 14:53 schrieb J C Nash:
> >  >>> 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:
> > nas...@uottawa.ca 

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

2019-06-07 Thread William Dunlap
I've attached a package, ppp_0.1.tar.gz, which probably will not get
through to R-help, that illustrates this.
It contains one function which, by default, triggers a condition-length>1
issue:
   f <- function(x = 1:3)
   {
   if (x > 1) {
   x <- -x
   }
   stop("this function always gives an error")
   }
and the help file example is
   try(f())

Then
   env _R_CHECK_LENGTH_1_CONDITION_=abort,verbose R-3.6.0 CMD check
--as-cran ppp_0.1.tar.gz
results in
* checking examples ... ERROR
Running examples in ‘ppp-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: f
> ### Title: Cause an error
> ### Aliases: f
> ### Keywords: error
>
> ### ** Examples
>
> try(f())
 --- FAILURE REPORT --
 --- failure: the condition has length > 1 ---
 --- srcref ---
:
 --- package (from environment) ---
ppp
 --- call from context ---
f()
 --- call from argument ---
if (x > 1) {
x <- -x
}
 --- R stacktrace ---
where 1: f()
where 2: doTryCatch(return(expr), name, parentenv, handler)
where 3: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 4: tryCatchList(expr, classes, parentenv, handlers)
where 5: tryCatch(expr, error = function(e) {
call <- conditionCall(e)
if (!is.null(call)) {
if (identical(call[[1L]], quote(doTryCatch)))
call <- sys.call(-4L)
dcall <- deparse(call)[1L]
prefix <- paste("Error in", dcall, ": ")
LONG <- 75L
sm <- strsplit(conditionMessage(e), "\n")[[1L]]
w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")
if (is.na(w))
w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],
type = "b")
if (w > LONG)
prefix <- paste0(prefix, "\n  ")
}
else prefix <- "Error : "
msg <- paste0(prefix, conditionMessage(e), "\n")
.Internal(seterrmessage(msg[1L]))
if (!silent && isTRUE(getOption("show.error.messages"))) {
cat(msg, file = outFile)
.Internal(printDeferredWarnings())
}
invisible(structure(msg, class = "try-error", condition = e))
})
where 6: try(f())

 --- value of length: 3 type: logical ---
[1] FALSE  TRUE  TRUE
 --- function from context ---
function (x = 1:3)
{
if (x > 1) {
x <- -x
}
stop("this function always gives an error")
}


 --- function search by body ---
Function f in namespace ppp has this body.
 --- END OF FAILURE REPORT --
Fatal error: the condition has length > 1
* checking PDF version of manual ... OK
* DONE

Status: 1 ERROR, 1 NOTE
See
  ‘/tmp/bill/ppp.Rcheck/00check.log’
for details.
Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Fri, Jun 7, 2019 at 10:21 AM Duncan Murdoch 
wrote:

> On 07/06/2019 12:32 p.m., William Dunlap wrote:
> > The length-condition-not-equal-to-one checks will cause R to shutdown
> > even if the code in a tryCatch().
>
> That's strange.  I'm unable to reproduce it with my tries, and John's
> package is no longer online.  Do you have an example I could look at?
>
> Duncan Murdoch
>
> >
> > Bill Dunlap
> > TIBCO Software
> > wdunlap tibco.com 
> >
> >
> > On Fri, Jun 7, 2019 at 7:47 AM Duncan Murdoch  > > wrote:
> >
> > On 07/06/2019 9:46 a.m., J C Nash wrote:
> >  > Should try() not stop those checks from forcing an error?
> >
> > try(stop("msg"))  will print the error message, but won't stop
> > execution.  Presumably the printed message is what is causing you
> > problems.  If you want to suppress that, use
> >
> > try(stop("msg"), silent = TRUE)
> >
> > Duncan Murdoch
> >
> >  >
> >  > I recognize that this is the failure -- it is indeed the check
> > I'm trying to
> >  > catch -- but I don't want tests of such checks to fail my package.
> >  >
> >  > JN
> >  >
> >  > On 2019-06-07 9:31 a.m., Sebastian Meyer wrote:
> >  >> The failure stated in the R CMD check failure report is:
> >  >>
> >  >>>   --- failure: length > 1 in coercion to logical ---
> >  >>
> >  >> This comes from --as-cran performing useful extra checks via
> > setting the
> >  >> environment variable _R_CHECK_LENGTH_1_LOGIC2_, which means:
> >  >>
> >  >>> check if either argument of the binary operators && and || has
> > length greater than one.
> >  >>
> >  >> (see
> > https://cran.r-project.org/doc/manuals/r-release/R-ints.html#Tools)
> >  >>
> >  >> The failure report also states the source of the failure:
> >  >>
> >  >>>   --- call from context ---
> >  >>> fchk(x, benbad, trace = 3, y)
> >  >>>   --- call from argument ---
> >  >>> is.infinite(fval) || is.na (fval)
> >  >>
> >  >> The problem is that both is.infinite(fval) and is.na
> > (fval) return
> >  >> vectors of length 10 in your test case:
> >  >>
> >  >>>   --- value of len

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

2019-06-07 Thread J C Nash
I've put my tiny package back up, but it likely is doing same
thing as Bill Dunlap's. I took it off as a cleanup when I thought
the issue resolved.

http://web.ncf.ca/fh448/jfiles/fchk_2019-6.5.tar.gz

Seems I've disturbed the ant's nest.

JN



On 2019-06-07 1:53 p.m., William Dunlap wrote:
> I've attached a package, ppp_0.1.tar.gz, which probably will not get through 
> to R-help, that illustrates this.
> It contains one function which, by default, triggers a condition-length>1 
> issue:
>    f <- function(x = 1:3)
>    {
>        if (x > 1) {
>            x <- -x
>        }
>        stop("this function always gives an error")
>    }
> and the help file example is
>    try(f())
> 
> Then 
>    env _R_CHECK_LENGTH_1_CONDITION_=abort,verbose R-3.6.0 CMD check --as-cran 
> ppp_0.1.tar.gz
> results in
> * checking examples ... ERROR
> Running examples in ‘ppp-Ex.R’ failed
> The error most likely occurred in:
> 
>> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
>> ### Name: f
>> ### Title: Cause an error
>> ### Aliases: f
>> ### Keywords: error
>>
>> ### ** Examples
>>
>> try(f())
>  --- FAILURE REPORT --
>  --- failure: the condition has length > 1 ---
>  --- srcref ---
> :
>  --- package (from environment) ---
> ppp
>  --- call from context ---
> f()
>  --- call from argument ---
> if (x > 1) {
>     x <- -x
> }
>  --- R stacktrace ---
> where 1: f()
> where 2: doTryCatch(return(expr), name, parentenv, handler)
> where 3: tryCatchOne(expr, names, parentenv, handlers[[1L]])
> where 4: tryCatchList(expr, classes, parentenv, handlers)
> where 5: tryCatch(expr, error = function(e) {
>     call <- conditionCall(e)
>     if (!is.null(call)) {
>         if (identical(call[[1L]], quote(doTryCatch)))
>             call <- sys.call(-4L)
>         dcall <- deparse(call)[1L]
>         prefix <- paste("Error in", dcall, ": ")
>         LONG <- 75L
>         sm <- strsplit(conditionMessage(e), "\n")[[1L]]
>         w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")
>         if (is.na (w))
>             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],
>                 type = "b")
>         if (w > LONG)
>             prefix <- paste0(prefix, "\n  ")
>     }
>     else prefix <- "Error : "
>     msg <- paste0(prefix, conditionMessage(e), "\n")
>     .Internal(seterrmessage(msg[1L]))
>     if (!silent && isTRUE(getOption("show.error.messages"))) {
>         cat(msg, file = outFile)
>         .Internal(printDeferredWarnings())
>     }
>     invisible(structure(msg, class = "try-error", condition = e))
> })
> where 6: try(f())
> 
>  --- value of length: 3 type: logical ---
> [1] FALSE  TRUE  TRUE
>  --- function from context ---
> function (x = 1:3)
> {
>     if (x > 1) {
>         x <- -x
>     }
>     stop("this function always gives an error")
> }
> 
> 
>  --- function search by body ---
> Function f in namespace ppp has this body.
>  --- END OF FAILURE REPORT --
> Fatal error: the condition has length > 1
> * checking PDF version of manual ... OK
> * DONE
> 
> Status: 1 ERROR, 1 NOTE
> See
>   ‘/tmp/bill/ppp.Rcheck/00check.log’
> for details.
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com 
> 
> 
> On Fri, Jun 7, 2019 at 10:21 AM Duncan Murdoch  > wrote:
> 
> On 07/06/2019 12:32 p.m., William Dunlap wrote:
> > The length-condition-not-equal-to-one checks will cause R to shutdown
> > even if the code in a tryCatch().
> 
> That's strange.  I'm unable to reproduce it with my tries, and John's
> package is no longer online.  Do you have an example I could look at?
> 
> Duncan Murdoch
> 
> >
> > Bill Dunlap
> > TIBCO Software
> > wdunlap tibco.com  
> >
> >
> > On Fri, Jun 7, 2019 at 7:47 AM Duncan Murdoch  
> > >> 
> wrote:
> >
> >     On 07/06/2019 9:46 a.m., J C Nash wrote:
> >      > Should try() not stop those checks from forcing an error?
> >
> >     try(stop("msg"))  will print the error message, but won't stop
> >     execution.  Presumably the printed message is what is causing you
> >     problems.  If you want to suppress that, use
> >
> >     try(stop("msg"), silent = TRUE)
> >
> >     Duncan Murdoch
> >
> >      >
> >      > I recognize that this is the failure -- it is indeed the check
> >     I'm trying to
> >      > catch -- but I don't want tests of such checks to fail my 
> package.
> >      >
> >      > JN
> >      >
> >      > On 2019-06-07 9:31 a.m., Sebastian Meyer wrote:
> >      >> The failure stated in the R CMD check failure report is:
> >      >>
> >      >>>   --- failure: length > 1 in coercion to logical ---
> >      >>
> >      >> This comes from --as-cran performing useful extr

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

2019-06-07 Thread Tierney, Luke
A simplified version without a package:

Sys.setenv("_R_CHECK_LENGTH_1_LOGIC2_"="abort,verbose")
tryCatch(1:3 || 1, error = identity)

Running this aborts the session since it calls R_Suicide without first
signaling a condition to try any available handlers. Should be easy to
change, but I don't know if there are any downsides for the CRAN
workflow. I'll look into it.

Best,

luke


On Fri, 7 Jun 2019, William Dunlap wrote:

> I've attached a package, ppp_0.1.tar.gz, which probably will not get
> through to R-help, that illustrates this.
> It contains one function which, by default, triggers a condition-length>1
> issue:
>   f <- function(x = 1:3)
>   {
>   if (x > 1) {
>   x <- -x
>   }
>   stop("this function always gives an error")
>   }
> and the help file example is
>   try(f())
>
> Then
>   env _R_CHECK_LENGTH_1_CONDITION_=abort,verbose R-3.6.0 CMD check
> --as-cran ppp_0.1.tar.gz
> results in
> * checking examples ... ERROR
> Running examples in ‘ppp-Ex.R’ failed
> The error most likely occurred in:
>
>> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
>> ### Name: f
>> ### Title: Cause an error
>> ### Aliases: f
>> ### Keywords: error
>>
>> ### ** Examples
>>
>> try(f())
> --- FAILURE REPORT --
> --- failure: the condition has length > 1 ---
> --- srcref ---
> :
> --- package (from environment) ---
> ppp
> --- call from context ---
> f()
> --- call from argument ---
> if (x > 1) {
>x <- -x
> }
> --- R stacktrace ---
> where 1: f()
> where 2: doTryCatch(return(expr), name, parentenv, handler)
> where 3: tryCatchOne(expr, names, parentenv, handlers[[1L]])
> where 4: tryCatchList(expr, classes, parentenv, handlers)
> where 5: tryCatch(expr, error = function(e) {
>call <- conditionCall(e)
>if (!is.null(call)) {
>if (identical(call[[1L]], quote(doTryCatch)))
>call <- sys.call(-4L)
>dcall <- deparse(call)[1L]
>prefix <- paste("Error in", dcall, ": ")
>LONG <- 75L
>sm <- strsplit(conditionMessage(e), "\n")[[1L]]
>w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")
>if (is.na(w))
>w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],
>type = "b")
>if (w > LONG)
>prefix <- paste0(prefix, "\n  ")
>}
>else prefix <- "Error : "
>msg <- paste0(prefix, conditionMessage(e), "\n")
>.Internal(seterrmessage(msg[1L]))
>if (!silent && isTRUE(getOption("show.error.messages"))) {
>cat(msg, file = outFile)
>.Internal(printDeferredWarnings())
>}
>invisible(structure(msg, class = "try-error", condition = e))
> })
> where 6: try(f())
>
> --- value of length: 3 type: logical ---
> [1] FALSE  TRUE  TRUE
> --- function from context ---
> function (x = 1:3)
> {
>if (x > 1) {
>x <- -x
>}
>stop("this function always gives an error")
> }
> 
> 
> --- function search by body ---
> Function f in namespace ppp has this body.
> --- END OF FAILURE REPORT --
> Fatal error: the condition has length > 1
> * checking PDF version of manual ... OK
> * DONE
>
> Status: 1 ERROR, 1 NOTE
> See
>  ‘/tmp/bill/ppp.Rcheck/00check.log’
> for details.
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
>
> On Fri, Jun 7, 2019 at 10:21 AM Duncan Murdoch 
> wrote:
>
>> On 07/06/2019 12:32 p.m., William Dunlap wrote:
>>> The length-condition-not-equal-to-one checks will cause R to shutdown
>>> even if the code in a tryCatch().
>>
>> That's strange.  I'm unable to reproduce it with my tries, and John's
>> package is no longer online.  Do you have an example I could look at?
>>
>> Duncan Murdoch
>>
>>>
>>> Bill Dunlap
>>> TIBCO Software
>>> wdunlap tibco.com 
>>>
>>>
>>> On Fri, Jun 7, 2019 at 7:47 AM Duncan Murdoch >> > wrote:
>>>
>>> On 07/06/2019 9:46 a.m., J C Nash wrote:
>>> > Should try() not stop those checks from forcing an error?
>>>
>>> try(stop("msg"))  will print the error message, but won't stop
>>> execution.  Presumably the printed message is what is causing you
>>> problems.  If you want to suppress that, use
>>>
>>> try(stop("msg"), silent = TRUE)
>>>
>>> Duncan Murdoch
>>>
>>> >
>>> > I recognize that this is the failure -- it is indeed the check
>>> I'm trying to
>>> > catch -- but I don't want tests of such checks to fail my package.
>>> >
>>> > JN
>>> >
>>> > On 2019-06-07 9:31 a.m., Sebastian Meyer wrote:
>>> >> The failure stated in the R CMD check failure report is:
>>> >>
>>> >>>   --- failure: length > 1 in coercion to logical ---
>>> >>
>>> >> This comes from --as-cran performing useful extra checks via
>>> setting the
>>> >> environment variable _R_CHECK_LENGTH_1_LOGIC2_, which means:
>>> >>
>>> >>> check if either argument of the binary operators && and || has
>>> length greater than one.
>>> >>
>>> >> (see

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

2019-06-07 Thread Duncan Murdoch

On 07/06/2019 1:53 p.m., William Dunlap wrote:
I've attached a package, ppp_0.1.tar.gz, which probably will not get 
through to R-help, that illustrates this.
It contains one function which, by default, triggers a 
condition-length>1 issue:

    f <- function(x = 1:3)
    {
        if (x > 1) {
            x <- -x
        }
        stop("this function always gives an error")
    }
and the help file example is
    try(f())

Then
    env _R_CHECK_LENGTH_1_CONDITION_=abort,verbose R-3.6.0 CMD check 
--as-cran ppp_0.1.tar.gz

results in
* checking examples ... ERROR
Running examples in ‘ppp-Ex.R’ failed
The error most likely occurred in:


Thanks, I see that now.  I'm still not seeing it without the explicit 
setting of the environment variable, i.e. --as-cran isn't setting it on 
the versions I'm using (3.6.0 and R-devel).


Duncan Murdoch

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Travis/appveyor with CXX14/17

2019-06-07 Thread Tim Keitt
On Fri, Jun 7, 2019 at 11:09 AM Dirk Eddelbuettel  wrote:

>
> On 7 June 2019 at 10:13, Tim Keitt wrote:
> | I bumped a package to CXX14/17 and it failed on Travis/Appveyor while
> | checking fine locally. I assume I need to request different compilers or
>
> Correct.
>
> Working with a seriously outdated base layer of Ubuntu is a key
> bug^Hfeature
> of Travis.  Maddening, really.
>
> | something like that. Anyone have a quick recipe for that?
>
> Yes.  In fact, two different ways.
>
> i)  If you use the old Travis set up which is more shell-script alike, then
> one way is to use a PPA for nighlies/more current gcc or clang
> versions. I used to do that some client packages that needed newer
> compilers. An older example is still here
>
> https://github.com/eddelbuettel/cpptoml/blob/master/.travis.yml
>
> ii) Screw Travis and use the fact that you can now bring your own Docker
> container.  That is much preferable as you are in _complete_ control of
> the test environment. I switched a few packages to this, particularly
> when they needed additional libraries which I was building / providing
> via a PPA anyway. Two examples:
>
>   https://github.com/eddelbuettel/rquantlib/blob/master/.travis.yml
>   https://github.com/rcppmlpack/rcppmlpack2/blob/master/.travis.yml
>
> If you don't need extra libraries then something like this container
> have
> R, recent toolchain and support for PPAs. I have been meaning to blog
> about it with an example:
>
>   https://hub.docker.com/r/rocker/r-apt
>
> Obviously you can also start from vanilla Rocker's r-base, or any other
> Debian container.  Again,  your control, possibly also your initial
> work.
>
> A scheme I found helpful in a few repos is to create
>
>   docker/ci/Dockerfile -- base layer for CI, used by Travis
>   docker/run/Dockerfile-- above plus the actual repo code
>
> where the latter one is a simple container for users of the package.
>

That's super helpful. Thanks.

THK


>
> Hth, Dirk
>
> --
> http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
>

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] checks on CRAN notes 'examples_i386', but checks elsewhere do not

2019-06-07 Thread Kassel Hingee
Thank you Georgi and Uwe! I've made doubly sure that "examples_and_tests"
isn't in my tarball and I've uploaded again to CRAN.

yours
Kassel

On Fri, 7 Jun 2019 at 17:07, Uwe Ligges 
wrote:

> Or you have been there at the wrong time when we enabled a new check
> that was not able to correctly deal with check directories produced
> under bi-arch check siutuations. This is fixed for wionbuilder and wil
> be fixed in the R sources soon,
> Uwe
>
>
>
> On 07.06.2019 09:31, Georgi Boshnakov wrote:
> > It looks like you get the note when you run the check on the package
> directory, rather than on the tarball of the package. Undoubtedly, you
> submitted the tarball towinbuilder. develops::check also first builds the
> package and then does the flecks on the tarball.
> >
> > If unwanted files do creep into the tarball, use file.Rbuildignore to
> tell the builder not to include them.
> >
> >
> >   Georgi Boshnakov
> >
> >
> > 
> > From: R-package-devel [r-package-devel-boun...@r-project.org] on behalf
> of Kassel Hingee [kassel.hin...@research.uwa.edu.au]
> > Sent: 07 June 2019 05:35
> > To: r-package-devel@r-project.org
> > Subject: [R-pkg-devel] checks on CRAN notes 'examples_i386', but checks
> elsewhere do not
> >
> > Hi All,
> >
> > This is my first time submitting a package to CRAN, and posting here. I
> > hope I get everything right.
> >
> > Checks ran by CRAN for Windows systems generated a note that I don't know
> > where to start to solve:
> >
> > * checking for non-standard things in the check directory ... NOTE
> > Found the following files/directories:
> >examples_i386 examples_x64 lacunaritycovariance-Ex_i386.Rout
> >lacunaritycovariance-Ex_x64.Rout tests_i386 tests_x64
> >
> >
> > This note was not generated when I uploaded the package directly to
> > winbuilder in either release or development versions of R.
> > It also wasn't generated when I ran devtools::check() on my own (unix)
> computer.
> >
> > The results of the CRAN check can be seen here for another few days:
> >
> https://win-builder.r-project.org/incoming_pretest/lacunaritycovariance_1.0-3_20190606_051128/
> > The check log containing the above note is here:
> >
> https://win-builder.r-project.org/incoming_pretest/lacunaritycovariance_1.0-3_20190606_051128/Windows/00check.log
> > The package source can bee seen here:
> > https://github.com/kasselhingee/lacunaritycovariance/tree/release
> >
> > I haven't noticed a solution discussed earlier on this email list and
> > web searching gave me no joy. I am hoping you can help!
> >
> > yours
> > Kassel
> >
> >  [[alternative HTML version deleted]]
> >
> > __
> > R-package-devel@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-package-devel
> >
> > __
> > R-package-devel@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-package-devel
> >
>

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel