[R-pkg-devel] Re-exporting S3 generics

2017-05-10 Thread Lenth, Russell V
Dear package developers:

My 'lsmeans' package provides, among other things, 'as.mcmc' and 'as.mcmc.list' 
methods for its 'ref.grid' objects. Those methods allow obtaining posterior 
predictions, or averages thereof, from certain models fitted using MCMC methods.

My question concerns this: the S3 generics for 'as.mcmc' and 'as.mcmc.list' 
exist in the 'coda' package. Therefore, 'coda' is listed in the Imports field 
of the DESCRIPTION file, and the NAMESPACE file imports these generics and 
registers my corresponding methods for the 'ref.grid' class. However, to use 
those methods, the user must either have the 'coda' package attached, or name 
it explicitly in calling as.mcmc -- even if the user doesn't want to use the 
coda package for anything else. For concreteness, consider the following 
illustration:

library("rstanarm")
example("stan_glm")
# ... (output suppressed) ...

library("lsmeans")
ref.grid(fit3)
## 'ref.grid' object with variables:
## outcome = 1, 2, 3
## treatment = 1, 2, 3
## Transformation: “log”

outcome.lsm <- lsmeans(fit3, "outcome")  # averages predictions over 
treatments
outcome.post <- as.mcmc(outcome.lsm)
## Error in as.mcmc(fit3) : could not find function "as.mcmc"

outcome.post <- coda::as.mcmc(outcome.lsm)

library(bayesplot)
mcmc_areas(outcome.post, prob = .9)

In this illustration, the user could have used the plot routines in the coda 
package to display the results; but instead, opted for the cooler ones in the 
'bayesplot' package. The user had no need at all for the 'coda' package except 
to locate the generic for 'as.mcmc'. This seems kind of user-unfriendly. 

But suppose I modify and rebuild the package so that it exports the generic 
'as.mcmc'. Then it would be visible to the user and the first 'as.mcmc' call 
above would have worked. This looks like it potentially could mess up the S3 
dispatching of this method. However, if I try it ...

# ... (Package rebuilt adding  'export(as.mcmc)'  to NAMESPACE) ...
as.mcmc
## function (x, ...) 
## UseMethod("as.mcmc")
## 

... it appears that it 'lsmeans' is not exporting a copy, but the exact same 
generic in the exact same namespace. So this re-exporting  seems harmless, and 
is a convenience to the user. (I'll comment that several older versions of 
'lsmeans' did export 'as.mcmc' and to my knowledge, nothing bad happened). Am I 
missing something?

Russ


Russell V. Lenth  -  Professor Emeritus
Department of Statistics and Actuarial Science   
The University of Iowa  -  Iowa City, IA 52242  USA   
Voice (319)335-0712 (Dept. office)  -  FAX (319)335-3017


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

[R-pkg-devel] Question on a NOTE when testing a package

2017-05-10 Thread Jang Ik Cho
I am getting the following messages as a note.

checking R code for possible problems ... NOTE: no visible
global function definition for ‘glm.nb’: no visible global
function definition for ‘rnegbin’Undefined global functions or
variables:  glm.nb rnegbin


Both glm.nb and rnegbin is from MASS and I am having hard time
resolving this issue because it lloks like we do not need to declare
MASS library.

Can anyone please help me to solve this issue and have the note to
disappear?

Thank you.

[[alternative HTML version deleted]]

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

[R-pkg-devel] Windows tests for CRAN submission

2017-05-10 Thread Shivaram Venkataraman
Hi

I'm a first time package submitter to CRAN and have a question on how to
handle unit tests on Windows. The SparkR [1] package [2] file that we are
trying to submit passes "R CMD check  --as-cran" with no errors on both
Linux and OS X.

On Windows, the package builds successfully but requires additional
binaries [3] to be installed in order for the unit tests to run. While we
have a automated test runner that installs the binaries and runs tests on
every commit [4] on AppVeyor, when "R CMD check --as-cran" is run on
winbuilder, the tests fail.

Given this situation, is it possible to specify in our CRAN submission that
the package should only be tested on Unix machines ? Or is it recommended
that we include scripts to install the additional binaries during a CRAN
check on winbuilder ?

Thanks for your help and please let me know if any further details about
the package will help in resolving this.

Thanks
Shivaram

[1] https://github.com/apache/spark/tree/master/R
[2]
http://people.apache.org/~pwendell/spark-releases/spark-2.1.1-rc4-bin/SparkR_2.1.1.tar.gz
[3] https://github.com/apache/spark/blob/master/R/WINDOWS.md#unit-tests
[4] https://ci.appveyor.com/project/ApacheSoftwareFoundation/spark/history

[[alternative HTML version deleted]]

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


[R-pkg-devel] [patch] R CMD check when there are no .Rd examples

2017-05-10 Thread Neal Richardson
Hi,
Last week I submitted a new package to CRAN, and it was rejected
because there were no examples in any of the man pages. That's a
reasonable requirement--I just didn't know it was one. When I looked
back at the R CMD check results locally, I saw

* checking examples ... NONE

but the run still finished with

Status: OK

so I believed that my package was good. The package did have usage
examples in the test suite and on the readme file, and it was no
problem to copy the examples over to a man page and resubmit. But it
seemed like an unfortunate and avoidable waste of the CRAN
maintainers' time to have to ask for revisions and review again.

I read the source and saw that the requirement around .Rd examples
that R CMD check does enforce is only when there are no examples, no
vignettes, and no tests
(https://github.com/wch/r-source/blob/trunk/src/library/tools/R/check.R#L5100-L5117).
The attached one-line patch makes the check for .Rd examples now log a
"Note" rather than just print "NONE". Running it against my package
without man-page examples, it shows

* checking examples ... NOTE
No examples

and ends with

Status: 1 NOTE

which should be enough to remind package authors to address it before
submitting to CRAN.

Thanks for considering this patch.

Neal

P.S. Since this is an issue about CRAN policy and package development,
I thought R-package-devel was the appropriate list to email, but
please let me know if I should send the patch to R-devel instead.
Index: src/library/tools/R/check.R
===
--- src/library/tools/R/check.R (revision 72665)
+++ src/library/tools/R/check.R (working copy)
@@ -2868,7 +2868,7 @@
  " check also with --run-donttest\n")
 }
 } else {
-resultLog(Log, "NONE")
+noteLog(Log, "No examples")
 no_examples <<- TRUE
 }
 }
__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Re: [R-pkg-devel] Question on a NOTE when testing a package

2017-05-10 Thread Uwe Ligges

Import from the MAS namespace.

Best,
Uwe Ligges



On 10.05.2017 05:54, Jang Ik Cho wrote:

I am getting the following messages as a note.

checking R code for possible problems ... NOTE: no visible
global function definition for ‘glm.nb’: no visible global
function definition for ‘rnegbin’Undefined global functions or
variables:  glm.nb rnegbin


Both glm.nb and rnegbin is from MASS and I am having hard time
resolving this issue because it lloks like we do not need to declare
MASS library.

Can anyone please help me to solve this issue and have the note to
disappear?

Thank you.

[[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] Windows tests for CRAN submission

2017-05-10 Thread Uwe Ligges

On 10.05.2017 07:58, Shivaram Venkataraman wrote:

Hi

I'm a first time package submitter to CRAN and have a question on how to
handle unit tests on Windows. The SparkR [1] package [2] file that we are
trying to submit passes "R CMD check  --as-cran" with no errors on both
Linux and OS X.

On Windows, the package builds successfully but requires additional
binaries [3] to be installed in order for the unit tests to run. While we
have a automated test runner that installs the binaries and runs tests on
every commit [4] on AppVeyor, when "R CMD check --as-cran" is run on
winbuilder, the tests fail.

Given this situation, is it possible to specify in our CRAN submission that
the package should only be tested on Unix machines ? Or is it recommended
that we include scripts to install the additional binaries during a CRAN
check on winbuilder ?


Tell me and if the requirements are reasonable and easy to install I'll 
consider to install them.


Best,
Uwe Ligges




Thanks for your help and please let me know if any further details about
the package will help in resolving this.

Thanks
Shivaram

[1] https://github.com/apache/spark/tree/master/R
[2]
http://people.apache.org/~pwendell/spark-releases/spark-2.1.1-rc4-bin/SparkR_2.1.1.tar.gz
[3] https://github.com/apache/spark/blob/master/R/WINDOWS.md#unit-tests
[4] https://ci.appveyor.com/project/ApacheSoftwareFoundation/spark/history

[[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] [patch] R CMD check when there are no .Rd examples

2017-05-10 Thread Uwe Ligges
There are packages where examples do not make sense, hence we do not 
generally reject such packages.


But if adding examples are reasonable we ask for them.

Best,
Uwe Ligges



On 10.05.2017 17:28, Neal Richardson wrote:

Hi,
Last week I submitted a new package to CRAN, and it was rejected
because there were no examples in any of the man pages. That's a
reasonable requirement--I just didn't know it was one. When I looked
back at the R CMD check results locally, I saw

* checking examples ... NONE

but the run still finished with

Status: OK

so I believed that my package was good. The package did have usage
examples in the test suite and on the readme file, and it was no
problem to copy the examples over to a man page and resubmit. But it
seemed like an unfortunate and avoidable waste of the CRAN
maintainers' time to have to ask for revisions and review again.

I read the source and saw that the requirement around .Rd examples
that R CMD check does enforce is only when there are no examples, no
vignettes, and no tests
(https://github.com/wch/r-source/blob/trunk/src/library/tools/R/check.R#L5100-L5117).
The attached one-line patch makes the check for .Rd examples now log a
"Note" rather than just print "NONE". Running it against my package
without man-page examples, it shows

* checking examples ... NOTE
No examples

and ends with

Status: 1 NOTE

which should be enough to remind package authors to address it before
submitting to CRAN.

Thanks for considering this patch.

Neal

P.S. Since this is an issue about CRAN policy and package development,
I thought R-package-devel was the appropriate list to email, but
please let me know if I should send the patch to R-devel instead.


patch.diff


Index: src/library/tools/R/check.R
===
--- src/library/tools/R/check.R (revision 72665)
+++ src/library/tools/R/check.R (working copy)
@@ -2868,7 +2868,7 @@
  " check also with --run-donttest\n")
 }
 } else {
-resultLog(Log, "NONE")
+noteLog(Log, "No examples")
 no_examples <<- TRUE
 }
 }



__
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] Windows tests for CRAN submission

2017-05-10 Thread Shivaram Venkataraman
On Wed, May 10, 2017 at 9:58 AM, Uwe Ligges  wrote:

> On 10.05.2017 07:58, Shivaram Venkataraman wrote:
>
>> Hi
>>
>> I'm a first time package submitter to CRAN and have a question on how to
>> handle unit tests on Windows. The SparkR [1] package [2] file that we are
>> trying to submit passes "R CMD check  --as-cran" with no errors on both
>> Linux and OS X.
>>
>> On Windows, the package builds successfully but requires additional
>> binaries [3] to be installed in order for the unit tests to run. While we
>> have a automated test runner that installs the binaries and runs tests on
>> every commit [4] on AppVeyor, when "R CMD check --as-cran" is run on
>> winbuilder, the tests fail.
>>
>> Given this situation, is it possible to specify in our CRAN submission
>> that
>> the package should only be tested on Unix machines ? Or is it recommended
>> that we include scripts to install the additional binaries during a CRAN
>> check on winbuilder ?
>>
>
> Tell me and if the requirements are reasonable and easy to install I'll
> consider to install them.
>
> Thanks for your reply. The requirements are to have the Hadoop windows
utils package installed. I wrote a small power shell script to do this at
https://gist.github.com/shivaram/bd5d17c31ce9d89035559fa956f59fc1 . The
script sets $HADOOP_HOME and adds $HADOOP_HOME/bin to $PATH. More details
about what is getting installed is at
https://github.com/steveloughran/winutils

On a related note: Would anybody happen to know what the value of JAVA_HOME
is set to on the winbuilder machine ?

Thanks
Shivaram


> Best,
> Uwe Ligges
>
>
>
> Thanks for your help and please let me know if any further details about
>> the package will help in resolving this.
>>
>> Thanks
>> Shivaram
>>
>> [1] https://github.com/apache/spark/tree/master/R
>> [2]
>> http://people.apache.org/~pwendell/spark-releases/spark-2.1.
>> 1-rc4-bin/SparkR_2.1.1.tar.gz
>> [3] https://github.com/apache/spark/blob/master/R/WINDOWS.md#unit-tests
>> [4] https://ci.appveyor.com/project/ApacheSoftwareFoundation/spa
>> rk/history
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> 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


Re: [R-pkg-devel] Question on a NOTE when testing a package

2017-05-10 Thread Jang Ik Cho
Thank you very much for the response. I've already tried import from
NAMESPACE but I got following message.

checking package dependencies ... ERRORNamespace dependency not required: ‘MASS’


Is there any other solutions?


-
Jang Ik Cho, MS
Ph.D. Candidate
Department of Epidemiology and Biostatistics
Case Western Reserve University
Graduate Research Assistant, SR2C
Graduate Research Assistant, Louis Stokes Cleveland VA Medical Center

On Wed, May 10, 2017 at 12:56 PM, Uwe Ligges <
lig...@statistik.tu-dortmund.de> wrote:

> Import from the MAS namespace.
>
> Best,
> Uwe Ligges
>
>
>
>
> On 10.05.2017 05:54, Jang Ik Cho wrote:
>
>> I am getting the following messages as a note.
>>
>> checking R code for possible problems ... NOTE: no visible
>> global function definition for ‘glm.nb’: no visible global
>> function definition for ‘rnegbin’Undefined global functions or
>> variables:  glm.nb rnegbin
>>
>>
>> Both glm.nb and rnegbin is from MASS and I am having hard time
>> resolving this issue because it lloks like we do not need to declare
>> MASS library.
>>
>> Can anyone please help me to solve this issue and have the note to
>> disappear?
>>
>> Thank you.
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> 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

Re: [R-pkg-devel] Question on a NOTE when testing a package

2017-05-10 Thread Uwe Ligges



On 11.05.2017 00:04, Jang Ik Cho wrote:

Thank you very much for the response. I've already tried import from
NAMESPACE but I got following message.

checking package dependencies ... ERROR Namespace dependency not
required: ‘MASS’



Come on, read Writing R Extensions. You have to declare it in the 
DESCRIPTION file as

Imports: MASS

Best,
Uwe Ligges





Is there any other solutions?


-
Jang Ik Cho, MS
Ph.D. Candidate
Department of Epidemiology and Biostatistics
Case Western Reserve University
Graduate Research Assistant, SR2C
Graduate Research Assistant, Louis Stokes Cleveland VA Medical Center

On Wed, May 10, 2017 at 12:56 PM, Uwe Ligges
mailto:lig...@statistik.tu-dortmund.de>> wrote:

Import from the MAS namespace.

Best,
Uwe Ligges




On 10.05.2017 05:54, Jang Ik Cho wrote:

I am getting the following messages as a note.

checking R code for possible problems ... NOTE: no visible
global function definition for ‘glm.nb’: no visible global
function definition for ‘rnegbin’Undefined global functions or
variables:  glm.nb rnegbin


Both glm.nb and rnegbin is from MASS and I am having hard time
resolving this issue because it lloks like we do not need to declare
MASS library.

Can anyone please help me to solve this issue and have the note to
disappear?

Thank you.

[[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] Question on a NOTE when testing a package

2017-05-10 Thread Jang Ik Cho
I see what you mean. Problem solved.
I wasn't familiar with the structure since it's my first time submitting to
CRAN.
Thank you very much.

Best Regards,
Jang


On Wed, May 10, 2017 at 6:51 PM, Uwe Ligges  wrote:

>
>
> On 11.05.2017 00:04, Jang Ik Cho wrote:
>
>> Thank you very much for the response. I've already tried import from
>> NAMESPACE but I got following message.
>>
>> checking package dependencies ... ERROR Namespace dependency not
>> required: ‘MASS’
>>
>
>
> Come on, read Writing R Extensions. You have to declare it in the
> DESCRIPTION file as
> Imports: MASS
>
> Best,
> Uwe Ligges
>
>
>
>>
>> Is there any other solutions?
>>
>>
>> -
>> Jang Ik Cho, MS
>> Ph.D. Candidate
>> Department of Epidemiology and Biostatistics
>> Case Western Reserve University
>> Graduate Research Assistant, SR2C
>> Graduate Research Assistant, Louis Stokes Cleveland VA Medical Center
>>
>> On Wed, May 10, 2017 at 12:56 PM, Uwe Ligges
>> > > wrote:
>>
>> Import from the MAS namespace.
>>
>> Best,
>> Uwe Ligges
>>
>>
>>
>>
>> On 10.05.2017 05:54, Jang Ik Cho wrote:
>>
>> I am getting the following messages as a note.
>>
>> checking R code for possible problems ... NOTE: no visible
>> global function definition for ‘glm.nb’: no visible global
>> function definition for ‘rnegbin’Undefined global functions or
>> variables:  glm.nb rnegbin
>>
>>
>> Both glm.nb and rnegbin is from MASS and I am having hard time
>> resolving this issue because it lloks like we do not need to
>> declare
>> MASS library.
>>
>> Can anyone please help me to solve this issue and have the note to
>> disappear?
>>
>> Thank you.
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> 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