Re: [R-pkg-devel] R CMD check works but with devtools::check() examples fail

2019-05-16 Thread Jack O. Wasey




Why do you think so? Don't the lines below the "-- Building" header
mean that devtools/rcmdcheck is building the package?


I saw (the last part of) this:

> ~/git/rdtLite.check/rdtLite.Rcheck/00_pkg_src/rdtLite -> R CMD check .

Sorry if I added some confusion: on closer inspection, it does look like 
this is R CMD check doing its normal thing.




G.

[...]

── Building ─
rdtLite ──
Setting env vars:
● CFLAGS: -Wall -pedantic -fdiagnostics-color=always
● CXXFLAGS  : -Wall -pedantic -fdiagnostics-color=always
● CXX11FLAGS: -Wall -pedantic -fdiagnostics-color=always

  checking for file
‘/Users/blerner/git/rdtLite.check/rdtLite.Rcheck/00_pkg_src✔  checking
for file
‘/Users/blerner/git/rdtLite.check/rdtLite.Rcheck/00_pkg_src/rdtLite/DESCRIPTION’
─  preparing ‘rdtLite’:
✔  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘rdtLite_1.0.3.tar.gz’

── Checking ─

[...]



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


Re: [R-pkg-devel] R CMD check works but with devtools::check() examples fail

2019-05-16 Thread Jack O. Wasey

Barbara,

On 5/15/19 5:09 PM, Barbara Lerner wrote:

I have just upgraded to R 3.6.0 and when building and checking my
package, R CMD check passes all the checks, including running the
examples, but devtools::check reports a failure when running the
examples.  I have also run the example successfully manually in RStudio.
I would appreciate help in understanding what devtools::check is doing
that R CMD check is not doing, or help in understanding the failure
report that devtools::check provides.

Here are somewhat abbreviated outputs from each:


~/git/rdtLite.check/rdtLite.Rcheck/00_pkg_src/rdtLite -> R CMD check .


Agree with Dirk, and also you are running R CMD check on the current 
directory, whereas Writing R Extensions recommends/insists on checking a 
tarball created using R CMD build:


"It is strongly recommended that the final checks are run on a tar 
archive prepared by R CMD build."


I've no idea how this might change checks (does it still look at 
.Rbuildignore?) but this might introduce additional problems.


Jack



* using log directory
‘/Users/blerner/git/rdtLite.check/rdtLite.Rcheck/00_pkg_src/rdtLite/..Rcheck’
* using R version 3.6.0 (2019-04-26)
* using platform: x86_64-apple-darwin15.6.0 (64-bit)
* using session charset: UTF-8
* checking for file ‘./DESCRIPTION’ ... OK
* this is package ‘rdtLite’ version ‘1.0.3’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... NOTE
Found the following hidden files and directories:
    .commit
    ..Rcheck
These were most likely included in error. See section ‘Package
structure’ in the ‘Writing R Extensions’ manual.
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘rdtLite’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... WARNING
Found the following directory with the name of a check directory:
    ./..Rcheck
Most likely, these were included erroneously.
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies
... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking dependencies in R code ... NOTE
Namespace in Imports field not imported from: ‘gtools’
    All declared Imports should be used.
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking examples ... OK
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
    Running ‘test-all.R’
   OK
* checking PDF version of manual ... OK
* DONE

Status: 1 WARNING, 2 NOTEs



~/git/rdtLite.check/rdtLite.Rcheck/00_pkg_src/rdtLite -> Rscript -e
"devtools::check()"
Updating rdtLite documentation
Warning: roxygen2 requires Encoding: UTF-8
Writing NAMESPACE
Loading rdtLite
Registered S3 methods overwritten by 'ggplot2':
    method from
    [.quosures rlang
    c.quosures rlang
    print.quosures rlang
Writing NAMESPACE
── Building ─
rdtLite ──
Setting env vars:
● CFLAGS    : -Wall -pedantic -fdiagnostics-color=always
● CXXFLAGS  : -Wall -pedantic -fdiagnostics-color=always
● CXX11FLAGS: -Wall -pedantic -fdiagnostics-color=always

     checking for file
‘/Users/blerner/git/rdtLite.check/rdtLite.Rcheck/00_pkg_src✔  checking
for file
‘/Users/blerner/git/rdtLite.check/rdtLite.Rcheck/00_pkg_src/rdtLite/DESCRIPTION’
─  preparing ‘rdtLite’:
✔  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘rdtLite_1.0.3.tar.gz’

── Checking ─
rdtLite ──
Setting env vars:
● _R_CHECK_CRAN_INCOMING_REMOTE_: FALSE
● _R_CHECK_CRAN_INCOMING_   : FALSE
● _R_CHECK_FORCE_SUGGESTS_  : FALSE
── 

Re: [R-pkg-devel] active bindings in package namespace

2019-03-24 Thread Jack O. Wasey
This is a good point. I would prefer to include all the data in the 
package, but CRAN has strict limitations on package and subdirectory 
size, which the potential data would easily exceed. Whether it is an 
active binding or a get function, dynamically downloaded data will 
always suffer this problem. Also, there are potential copyright issues 
which may prevent including all the relevant data in a package, no 
matter how the package is distributed.


For this particular package of ICD data, the biggest risk is not the 
data changing, but the data not being made available in the future, or 
not being provided in a useful format.


I do allow the user to set the cache directory, which eventually 
includes all the raw and processed data, and this could be archived by 
the user for reproducibilty. In addition, the test suite covers 
potential changes to the source data.


On 3/24/19 11:21 AM, Hong Ooi wrote:

Don't want to turn this into a pile-on, but I also think this isn't a very good idea. As 
I understand it, accessing the symbol "foo" will pull the latest version of foo 
from the remote site. This has consequences for reproducibility, because now your code 
could be exactly the same, and your local environment exactly the same, and yet running 
the code at different times can yield different results because the remote data has been 
updated.


-Original Message-
From: R-package-devel  On Behalf Of Jack 
Wasey
Sent: Sunday, 24 March 2019 9:57 AM
To: Kirill Müller ; R Development 

Subject: Re: [R-pkg-devel] active bindings in package namespace

Thanks both, this is helpful advice.

On 3/23/19 5:14 PM, Kirill Müller wrote:

Dear Jack


This doesn't answer your question, but I would advise against this design.

- Users do not expect side effects (such as network access) from accessing a 
symbol.

- A function gives you much more flexibility to change the interface
later on. (Arguments for fetching the data, tokens for API access,
...)

- You already encountered a few quirks that make this an "interesting" problem.

A function call only needs a pair of parentheses.


Best regards

Kirill


On 23.03.19 16:50, Jack O. Wasey wrote:

Dear all,

I am developing a package which is a front for various online data (icd.data 
https://github.com/jackwasey/icd.data/ ). The current CRAN version just has 
lazy-loaded data, but now the package encompasses far more current and historic 
ICD codes from different countries, these can't be included in the CRAN package 
even with maximal compression.

Other authors have solved this using functions to get the data, with or without 
a local cache of the retrieved data. No CRAN or other packages I have found 
after extensive searching use the attractive active binding feature of R.

The goal is simple: for the user to refer to the data by its symbol, e.g., 
'icd10fr2019', or 'icd.data::icd10fr2019', and it will be downloaded and parsed 
transparently (if the user has already granted permission, or after prompt if 
they haven't).

The bindings are set using commands alongside the function definitions in R/*.R 
.E.g.

makeActiveBinding("icd10cm_latest", .icd10cm_latest_binding,
environment()) lockBinding("icd10cm_latest", environment())

For non-interactive use, CI and CRAN tests, no data should be downloaded, and 
no cache directory set up without user consent. For interactive use, I ask 
permission to create a local data cache before downloading data.

This works fine... until R CMD check. The following steps seems to 'get' or 
'source' everything from the package namespace, which results in triggering the 
active bindings, and this fails if I am unable to get consent to download data, 
and want to 'stop' on this error condition.
  - checking dependencies in R code
  - checking S3 generic/method consistency
  - checking foreign function calls
  - checking R code for possible problems

Debugging CI-specific binding bugs is a nightmare because these occur in 
different R sessions initiated by R CMD check.

There may be legitimate reasons to evaluate everything in the
namespace, but I've no idea what they are. Incidentally, Rstudio also
does 'mget' on the whole package namespace and triggers bindings
during autocomplete. https://github.com/rstudio/rstudio/issues/4414

Is this something I should raise as an issue with R? Or does anyone have any 
idea of a sensible approach to this. Currently I have a set of workarounds, but 
this complicates the code, and has taken an awful lot of time. Does anyone know 
of any CRAN package which has active bindings in the package namespace?

Any ideas appreciated.

Jack Wasey

__
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-pkg-devel] active bindings in package namespace

2019-03-23 Thread Jack O. Wasey

Dear all,

I am developing a package which is a front for various online data 
(icd.data https://github.com/jackwasey/icd.data/ ). The current CRAN 
version just has lazy-loaded data, but now the package encompasses far 
more current and historic ICD codes from different countries, these 
can't be included in the CRAN package even with maximal compression.


Other authors have solved this using functions to get the data, with or 
without a local cache of the retrieved data. No CRAN or other packages I 
have found after extensive searching use the attractive active binding 
feature of R.


The goal is simple: for the user to refer to the data by its symbol, 
e.g., 'icd10fr2019', or 'icd.data::icd10fr2019', and it will be 
downloaded and parsed transparently (if the user has already granted 
permission, or after prompt if they haven't).


The bindings are set using commands alongside the function definitions 
in R/*.R .E.g.


makeActiveBinding("icd10cm_latest", .icd10cm_latest_binding, environment())
lockBinding("icd10cm_latest", environment())

For non-interactive use, CI and CRAN tests, no data should be 
downloaded, and no cache directory set up without user consent. For 
interactive use, I ask permission to create a local data cache before 
downloading data.


This works fine... until R CMD check. The following steps seems to 'get' 
or 'source' everything from the package namespace, which results in 
triggering the active bindings, and this fails if I am unable to get 
consent to download data, and want to 'stop' on this error condition.

 - checking dependencies in R code
 - checking S3 generic/method consistency
 - checking foreign function calls
 - checking R code for possible problems

Debugging CI-specific binding bugs is a nightmare because these occur in 
different R sessions initiated by R CMD check.


There may be legitimate reasons to evaluate everything in the namespace, 
but I've no idea what they are. Incidentally, Rstudio also does 'mget' 
on the whole package namespace and triggers bindings during 
autocomplete. https://github.com/rstudio/rstudio/issues/4414


Is this something I should raise as an issue with R? Or does anyone have 
any idea of a sensible approach to this. Currently I have a set of 
workarounds, but this complicates the code, and has taken an awful lot 
of time. Does anyone know of any CRAN package which has active bindings 
in the package namespace?


Any ideas appreciated.

Jack Wasey

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