Re: [Rd] Unexpected failure when calling new() with unnamed arg and

2015-05-13 Thread Martin Maechler
 Hervé Pagès hpa...@fredhutch.org
 on Tue, 12 May 2015 15:18:42 -0700 writes:

 Hi,

 The man page for new() suggests that if 'a' is an object with slots
 slot1 and slot2 and C is a class that extends the class of 'a',
 then the 2 following calls should be equivalent:

new(C, a, ...)
new(C, slot1=a@slot1, slot2=a@slot2, ...)

 This is generally the case but I just ran into a situation where it's
 not. In the following example the former fails while the latter works:

setClass(A, representation(slot1=numeric, slot2=logical))
setClass(B, contains=A, representation(design=formula))
setClass(C, contains=B)
a - new(A, slot1=77, slot2=TRUE)

new(C, a, design=x ~ y)  # fails
new(C, slot1=a@slot1, slot2=a@slot2, design=x ~ y)  # works

 Note that new(B, a, design=x ~ y) works so the 3-level class
 hierarchy is really needed in order to reproduce.

 Probably related to this, I also noted that new(B) and/or new(C)
 return invalid objects:

c - new(C)

validObject(c)
# Error in validObject(c) :
#  invalid class “C” object: invalid object for slot design
#  in class C: got class S4, should be or extend class formula

is(c@design, formula)
# [1] FALSE

class(c@design)
# [1] S4

 Note that 'c' can be fixed:

c@design - formula(NULL)

validObject(c)
# [1] TRUE

 Maybe something that the default initialize method should take care
 of?

 Another singularity that is maybe at the root of all of this is that
 the formula S4 class is virtual:

showClass(formula)
# Virtual Class formula [package methods]
#
# Slots:
#
# Name:   .S3Class
# Class: character
#
# Extends: oldClass

 so a bare call to new(formula) fails:

new(formula)
# Error in new(formula) :
#   trying to generate an object from a virtual class (formula)

 Shouldn't new(formula) just return an empty S3 formula (like
 formula(NULL) does), in the same way that new(integer) returns
 an empty ordinary integer vector?

Interesting .. and at least worth following.

One problem and historical reason for the current setup seems
that the formula S3 class is not from 'base' but 'stats' :

R's source, src/library/methods/R/BasicClasses.R,
lines 524 ff has the following comment block

|  .OldClassesPrototypes is a list of S3 classes for which prototype
|  objects are known  reasonable.  The classes will reappear in
|  .OldClassesList, but will have been initialized first in
|  .InitBasicClasses.  NB:  the methods package will NOT set up
|  prototypes for S3 classes except those in package base and for ts
|  (and would rather not do those either).  The package that owns the
|  S3 class should have code to call setOldClass in its
|  initialization.

So, when John Chambers wrote this, he envisioned that the
'stats' package would do the correct thing for its own classes.
OTOH, as history went, the stats package was never allowed to
depend on methods.
There are many other S3 classes from 'stats' which also end up
similarly, being defined via  setOldClass() and that itself
produces a VIRTUAL class.
Also, another part of the (R source) comment above is no longer
quite accurate, e.g., data.frame is in .OldClassesPrototypes
but not in .OldClassesList ...

As I do agree that formula is much more basic than these other classes,
I'm currently looking at tweaks to the methods (and stats) code,
to get this to work as indeed - you mentioned above -  we
already allow empty S3 formula objects anyway.

... half an hour later : Indeed, I've been able to use the above information
such that  new(formula) and new(formula, y ~ x)  
work.

However, your code above now --- with my changes --- would  fail :

  setClass(A, representation(slot1=numeric, slot2=logical))
  setClass(B, contains=A, representation(design=formula))
  setClass(C, contains=B)
 Error in reconcilePropertiesAndPrototype(name, slots, prototype, superClasses, 
 : 
   B is not eligible to be the data part of another class (must be a basic 
class or a virtual class with no slots)
  

So, I am not yet committing my changes to R-devel.
Hopefully more on this, later today.

Martin Maechler,
ETH Zurich


 Thanks,
 H.

   sessionInfo()
 R version 3.2.0 Patched (2015-04-17 r68202)
 Platform: x86_64-unknown-linux-gnu (64-bit)
 Running under: Ubuntu 14.04.2 LTS

 -- 
 Hervé Pagès
 Fred Hutchinson Cancer Research Center

 [..]

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


Re: [Rd] Alternative for wildcard gnu extension in Makevars

2015-05-13 Thread Jan van der Laan



On 13-05-15 18:08, Gábor Csárdi wrote:

On Wed, May 13, 2015 at 12:05 PM, Jan van der Laan rh...@eoos.dds.nl
mailto:rh...@eoos.dds.nl wrote:
[...]

Too bad. Since it is only a handful of files, I will probably move
them directly into the src directory and prefix them. It would have
been nice to have been able to keep them separate.


If it is a couple of files, then you can also just list them in SOURCES
(or even just OBJECTS, with a .o suffix), and leave them where they are.




That would be a nice solution, but it is a couple (~10) files in the 
src/boost_src directory. Directly under the src directory there are much 
more files, and the names and number of these will frequently change so 
I don't want to keep maintaining this list. Although I could add the 
generation of Makevars to my build script.


Thanks for the suggestion.

Jan

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


Re: [Rd] Alternative for wildcard gnu extension in Makevars

2015-05-13 Thread Henrik Bengtsson
While at it:  'Makevars' is an R invention (i.e. documentation of it
is only available through the R docs), correct?  /Henrik

On Wed, May 13, 2015 at 10:10 AM, Kevin Ushey kevinus...@gmail.com wrote:
 One other solution that's only a little crazy: you could have a R
 function within your package that generates the appropriate (portable)
 Makevars, and within the package `configure` script call that
 function. For example

 R --vanilla --slave -e source('R/makevars.R'); makevars()

 And that 'makevars()' function could generate portable
 'Makevars(.win)' files for your package.

 Kevin

 On Wed, May 13, 2015 at 9:08 AM, Gábor Csárdi csardi.ga...@gmail.com wrote:
 On Wed, May 13, 2015 at 12:05 PM, Jan van der Laan rh...@eoos.dds.nl
 wrote:
 [...]

 Too bad. Since it is only a handful of files, I will probably move them
 directly into the src directory and prefix them. It would have been nice to
 have been able to keep them separate.


 If it is a couple of files, then you can also just list them in SOURCES (or
 even just OBJECTS, with a .o suffix), and leave them where they are.

 Gabor

 [...]

 [[alternative HTML version deleted]]

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

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

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


Re: [Bioc-devel] Use and Usability metrics / shields

2015-05-13 Thread Dan Tenenbaum


- Original Message -
 From: Martin Morgan mtmor...@fredhutch.org
 To: bioc-devel@r-project.org
 Sent: Saturday, May 9, 2015 10:15:13 AM
 Subject: [Bioc-devel] Use and Usability metrics / shields
 
 Bioc developers!
 
 It's important that our users be able to identify packages that are
 suitable for
 their research question. Obviously a first step is to identify
 packages in the
 appropriate research domain, for instance through biocViews.
 
http://bioconductor.org/packages/release/
 
 We'd like to help users further prioritize their efforts by
 summarizing use and
 usability. Metrics include:
 
 - Cross-platform availability -- biocLite()-able from all or only
 some platforms
 - Support forum activity -- questions and comments / responses, 6
 month window
 - Download percentile -- top 5, 20, 50%, or 'available'
 - Current build status -- errors or warnings on some or all platforms
 - Developer activity -- commits in the last 6 months
 - Historical presence -- years in Bioconductor
 
 Obviously the metrics are imperfect, so constructive feedback welcome
 -- we
 think the above capture in a more-or-less objective and computable
 way the major
 axes influencing use and usability.
 
 We initially intend to prominently display 'shields' (small graphical
 icons) on
 package landing pages.

This has now been implemented. You can see it at e.g.

http://bioconductor.org/packages/release/bioc/html/BiocGenerics.html

The shields are also available for use externally, for example if you want to 
display build status on a README in Github. Just pull in the image from:

http://bioconductor.org/shields/build/release/bioc/BiocGenerics.svg

Note that devel has a different build shield:

http://bioconductor.org/shields/build/devel/bioc/BiocGenerics.svg

Thanks,
Dan

___
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel


[Rd] example fails during R CMD CHECK but works interactively?

2015-05-13 Thread Charles Determan
Greetings,

I am collaborating with developing the bigmemory package and have run in to
a strange problem when we run R CMD CHECK.  For some reason that isn't
clear to us one of the examples crashes stating:

Error:  memory could not be allocated for instance of type big.matrix

You can see the output on the Travis CI page at
https://travis-ci.org/kaneplusplus/bigmemory where the error starts at line
1035.  This is completely reproducible when running
devtools::check(args='--as-cran') locally.  The part that is confusing is
that the calls work perfectly when called interactively.

Hadley comments on the 'check' page of his R packages website (
http://r-pkgs.had.co.nz/check.html) regarding test failing following R CMD
check:

Occasionally you may have a problem where the tests pass when run
interactively with devtools::test(), but fail when in R CMD check. This
usually indicates that you’ve made a faulty assumption about the testing
environment, and it’s often hard to figure it out.

Any thoughts on how to troubleshoot this problem?  I have no idea what
assumption we could have made.

Regards,
Charles

[[alternative HTML version deleted]]

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


Re: [Rd] example fails during R CMD CHECK but works interactively?

2015-05-13 Thread Dan Tenenbaum


- Original Message -
 From: Charles Determan cdeterma...@gmail.com
 To: r-devel@r-project.org
 Sent: Wednesday, May 13, 2015 11:31:36 AM
 Subject: [Rd] example fails during R CMD CHECK but works interactively?
 
 Greetings,
 
 I am collaborating with developing the bigmemory package and have run
 in to
 a strange problem when we run R CMD CHECK.  For some reason that
 isn't
 clear to us one of the examples crashes stating:
 
 Error:  memory could not be allocated for instance of type big.matrix
 
 You can see the output on the Travis CI page at
 https://travis-ci.org/kaneplusplus/bigmemory where the error starts
 at line
 1035.  This is completely reproducible when running
 devtools::check(args='--as-cran') locally.  The part that is
 confusing is
 that the calls work perfectly when called interactively.
 
 Hadley comments on the 'check' page of his R packages website (
 http://r-pkgs.had.co.nz/check.html) regarding test failing following
 R CMD
 check:
 
 Occasionally you may have a problem where the tests pass when run
 interactively with devtools::test(), but fail when in R CMD check.
 This
 usually indicates that you’ve made a faulty assumption about the
 testing
 environment, and it’s often hard to figure it out.
 
 Any thoughts on how to troubleshoot this problem?  I have no idea
 what
 assumption we could have made.

Note that R CMD check runs R with environment variables set as follows (at 
least on my system; you can check $R_HOME/bin/check to see what it does on 
yours):

 R_DEFAULT_PACKAGES= LC_COLLATE=C 

So try staring R like this:

 R_DEFAULT_PACKAGES= LC_COLLATE=C  R

And see if that reproduces the test failure. The locale setting could affect 
tests of sort order, and the default package setting could potentially affect 
other things.

Dan



 
 Regards,
 Charles
 
   [[alternative HTML version deleted]]
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel


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


Re: [Bioc-devel] Use and Usability metrics / shields

2015-05-13 Thread Henrik Bengtsson
Sweet; you went live with the badges/shields, e.g.

  http://bioconductor.org/packages/release/bioc/html/affxparser.html

A positive side effect is that now there's a link from the package
page to to the package's check results, which I always wanted :)

Thanks for adding this

/Henrik


On Sun, May 10, 2015 at 11:39 AM, COMMO Frederic
frederic.co...@gustaveroussy.fr wrote:
 Dear Martin,

 All of these suggestions sound good.

 Wolfgang's suggestion regarding possible associated papers might be also 
 great.

 Another useful information would be to point to other publications where a 
 given package was used, and cited.
 I don't know if it's technically possible, but it would be greatly 
 informative to know how frequently a package is used, and how it performs, in 
 real contexts.

 Frederic Commo
 Bioinformatics, U981
 Gustave Roussy

 
 De : Bioc-devel [bioc-devel-boun...@r-project.org] de la part de Wolfgang 
 Huber [whu...@embl.de]
 Date d'envoi : samedi 9 mai 2015 19:57
 À : Martin Morgan
 Cc: bioc-devel@r-project.org
 Objet : Re: [Bioc-devel] Use and Usability metrics / shields

 Dear Martin

 great idea.
 Current build status” could perhaps be wrapped with Cross-platform 
 availability” into some sort of “Availability / Accessibility”?

 I wonder how informative it would be to make metrics such as
 (i) citations of the associated paper
 (ii) full-text mentions e.g. in PubmedCentral
 actually useful. (i) could be flawed if package and paper are diverged; (ii) 
 would require good disambiguation, e.g. like bioNerDS 
 http://www.biomedcentral.com/1471-2105/14/194 (or other tools? not my 
 expertise). Do we have someone with capabilities in this area on this list?

 PS  Martin you’ll like Fig. 2 of their paper.

 Wolfgang





 On May 9, 2015, at 19:15 GMT+2, Martin Morgan mtmor...@fredhutch.org wrote:

 Bioc developers!

 It's important that our users be able to identify packages that are suitable 
 for their research question. Obviously a first step is to identify packages 
 in the appropriate research domain, for instance through biocViews.

  http://bioconductor.org/packages/release/

 We'd like to help users further prioritize their efforts by summarizing use 
 and usability. Metrics include:

 - Cross-platform availability -- biocLite()-able from all or only some 
 platforms
 - Support forum activity -- questions and comments / responses, 6 month 
 window
 - Download percentile -- top 5, 20, 50%, or 'available'
 - Current build status -- errors or warnings on some or all platforms
 - Developer activity -- commits in the last 6 months
 - Historical presence -- years in Bioconductor

 Obviously the metrics are imperfect, so constructive feedback welcome -- we 
 think the above capture in a more-or-less objective and computable way the 
 major axes influencing use and usability.

 We initially intend to prominently display 'shields' (small graphical icons) 
 on package landing pages.

 Thanks in advance for your comments,

 Martin Morgan
 Bioconductor
 --
 Computational Biology / Fred Hutchinson Cancer Research Center
 1100 Fairview Ave. N.
 PO Box 19024 Seattle, WA 98109

 Location: Arnold Building M1 B861
 Phone: (206) 667-2793

 ___
 Bioc-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/bioc-devel

 ___
 Bioc-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/bioc-devel

 ___
 Bioc-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/bioc-devel

___
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel


Re: [Rd] CRAN check for package on Sparc Solaris

2015-05-13 Thread Viechtbauer Wolfgang (STAT)
Thank you for the kind offer! Unfortunately, the problem is really Sparc 
Solaris:

http://cran.r-project.org/web/checks/check_results_metafor.html

On Solaris x86 and all other flavors, it passes without errors.

Best,
Wolfgang

From: Gábor Csárdi [csardi.ga...@gmail.com]
Sent: Wednesday, May 13, 2015 9:53 PM
To: Viechtbauer Wolfgang (STAT)
Cc: r-devel@r-project.org
Subject: Re: [Rd] CRAN check for package on Sparc Solaris

Hi Wolfgang, I can test your package, please send it to me in private.  

Btw. I only have an x86 machine, and no sparc, so if your problem is 
sparc-specific, then my test is probably useless. 


Gabor


On Wed, May 13, 2015 at 3:48 PM, Viechtbauer Wolfgang (STAT) 
wolfgang.viechtba...@maastrichtuniversity.nl wrote:

Dear All,

The metafor package currently fails CRAN checks on Sparc Solaris:

http://cran.r-project.org/web/checks/check_results_metafor.html

The problem is probably due to an unintended (= stupid) use of identical() in a 
couple tests. I have changed that to more appropriate tests using all.equal(). 
However, before I resubmit the package to CRAN, I would really like to make 
sure that the updated package passes all checks also on Sparc Solaris.

The issue/question of how to test packages on Sparc Solaris has come up before:

https://stat.ethz.ch/pipermail/r-devel/2010-September/058538.html
https://stat.ethz.ch/pipermail/r-devel/2011-November/062430.html

Unless anything has changed in the meantime, it seems like the help of kind 
volunteers is still the only option to conduct such tests. So, is there anybody 
out there with access to a Sparc machine running Solaris willing to run 'R CMD 
check --as-cran' on the updated tarball? Would be very much appreciated!

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


Re: [Rd] LDFLAGS defined in R_MAKEVARS_USER file is ignored for R CMD SHLIB on Windows

2015-05-13 Thread Jim Hester
I have tracked this discrepancy down to the use of `SHLIB_LD` rather than
`SHLIB_LINK` in share/make/winshlib.mk
https://github.com/wch/r-source/blob/7348d71d1cb18e9c4b55950fd57198e8d2abcc8b/share/make/winshlib.mk.
This variable has been used in winshlib.mk since svn r47953
https://github.com/wch/r-source/commit/3ebd185c0745bdc7cb8dd185bd7df5ff7f827f18,
however the corresponding shlib.mk for linux has always used `SHLIB_LINK`
instead.

The attached patch updates the variables in winshlib.mk to use `SHLIB_LINK`
and makes the behavior consistent across platforms, which fixes my issue.

On Mon, May 11, 2015 at 12:28 PM, Jim Hester james.f.hes...@gmail.com
wrote:

 Example input and output to reproduce this can be found at
 https://gist.github.com/jimhester/b7f05f50794c88e44b17.

 I tested this attempting to compile the [digest](
 http://cran.r-project.org/web/packages/digest/index.html) package,
 `run.sh` and `run.bat` were both run in the package source directory on
 Ubuntu 14.01 and Windows 7 respectively.

 In particular while the `CFLAGS` values were properly passed to the
 compiler on both Linux and Windows, the `LDFLAGS` value was only passed to
 the linker on Linux, which caused the subsequent linking errors on Windows.

 Perhaps this is intended behavior, if so is there a different compiler
 variable I can use to pass flags to the linker on Windows?

Index: share/make/winshlib.mk
===
--- share/make/winshlib.mk	(revision 68364)
+++ share/make/winshlib.mk	(working copy)
@@ -10,13 +10,13 @@
 $(SHLIB): $(OBJECTS)
 	@if test z$(OBJECTS) != z; then \
 	  if test -e $(BASE)-win.def; then \
-	echo $(SHLIB_LD) -shared $(DLLFLAGS) -o $@ $(BASE)-win.def $(OBJECTS) $(ALL_LIBS); \
-	$(SHLIB_LD) -shared $(DLLFLAGS) -o $@ $(BASE)-win.def $(OBJECTS) $(ALL_LIBS); \
+	echo $(SHLIB_LINK) -shared $(DLLFLAGS) -o $@ $(BASE)-win.def $(OBJECTS) $(ALL_LIBS); \
+	$(SHLIB_LINK) -shared $(DLLFLAGS) -o $@ $(BASE)-win.def $(OBJECTS) $(ALL_LIBS); \
 	  else \
 	echo EXPORTS  tmp.def; \
 	$(NM) $^ | $(SED) -n $(SYMPAT) $(NM_FILTER)  tmp.def; \
-	echo $(SHLIB_LD) -shared $(DLLFLAGS) -o $@ tmp.def $(OBJECTS) $(ALL_LIBS); \
-	$(SHLIB_LD) -shared $(DLLFLAGS) -o $@ tmp.def $(OBJECTS) $(ALL_LIBS); \
+	echo $(SHLIB_LINK) -shared $(DLLFLAGS) -o $@ tmp.def $(OBJECTS) $(ALL_LIBS); \
+	$(SHLIB_LINK) -shared $(DLLFLAGS) -o $@ tmp.def $(OBJECTS) $(ALL_LIBS); \
 	$(RM) tmp.def; \
 	  fi \
 	fi
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] example fails during R CMD CHECK but works interactively?

2015-05-13 Thread Charles Determan
Thank you Dan but it isn't my tests that are failing (all of them pass
without problem) but one of the examples from the inst/examples directory.
I did try, however, to start R with the environmental variables as you
suggest but it had no effect on my tests.

Charles

On Wed, May 13, 2015 at 1:51 PM, Dan Tenenbaum dtene...@fredhutch.org
wrote:



 - Original Message -
  From: Charles Determan cdeterma...@gmail.com
  To: r-devel@r-project.org
  Sent: Wednesday, May 13, 2015 11:31:36 AM
  Subject: [Rd] example fails during R CMD CHECK but works interactively?
 
  Greetings,
 
  I am collaborating with developing the bigmemory package and have run
  in to
  a strange problem when we run R CMD CHECK.  For some reason that
  isn't
  clear to us one of the examples crashes stating:
 
  Error:  memory could not be allocated for instance of type big.matrix
 
  You can see the output on the Travis CI page at
  https://travis-ci.org/kaneplusplus/bigmemory where the error starts
  at line
  1035.  This is completely reproducible when running
  devtools::check(args='--as-cran') locally.  The part that is
  confusing is
  that the calls work perfectly when called interactively.
 
  Hadley comments on the 'check' page of his R packages website (
  http://r-pkgs.had.co.nz/check.html) regarding test failing following
  R CMD
  check:
 
  Occasionally you may have a problem where the tests pass when run
  interactively with devtools::test(), but fail when in R CMD check.
  This
  usually indicates that you’ve made a faulty assumption about the
  testing
  environment, and it’s often hard to figure it out.
 
  Any thoughts on how to troubleshoot this problem?  I have no idea
  what
  assumption we could have made.

 Note that R CMD check runs R with environment variables set as follows (at
 least on my system; you can check $R_HOME/bin/check to see what it does on
 yours):

  R_DEFAULT_PACKAGES= LC_COLLATE=C

 So try staring R like this:

  R_DEFAULT_PACKAGES= LC_COLLATE=C  R

 And see if that reproduces the test failure. The locale setting could
 affect tests of sort order, and the default package setting could
 potentially affect other things.

 Dan



 
  Regards,
  Charles
 
[[alternative HTML version deleted]]
 
  __
  R-devel@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-devel
 


[[alternative HTML version deleted]]

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


Re: [Rd] CRAN check for package on Sparc Solaris

2015-05-13 Thread Gábor Csárdi
Hi Wolfgang, I can test your package, please send it to me in private.

Btw. I only have an x86 machine, and no sparc, so if your problem is
sparc-specific, then my test is probably useless.

Gabor

On Wed, May 13, 2015 at 3:48 PM, Viechtbauer Wolfgang (STAT) 
wolfgang.viechtba...@maastrichtuniversity.nl wrote:

 Dear All,

 The metafor package currently fails CRAN checks on Sparc Solaris:

 http://cran.r-project.org/web/checks/check_results_metafor.html

 The problem is probably due to an unintended (= stupid) use of identical()
 in a couple tests. I have changed that to more appropriate tests using
 all.equal(). However, before I resubmit the package to CRAN, I would really
 like to make sure that the updated package passes all checks also on Sparc
 Solaris.

 The issue/question of how to test packages on Sparc Solaris has come up
 before:

 https://stat.ethz.ch/pipermail/r-devel/2010-September/058538.html
 https://stat.ethz.ch/pipermail/r-devel/2011-November/062430.html

 Unless anything has changed in the meantime, it seems like the help of
 kind volunteers is still the only option to conduct such tests. So, is
 there anybody out there with access to a Sparc machine running Solaris
 willing to run 'R CMD check --as-cran' on the updated tarball? Would be
 very much appreciated!

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


[[alternative HTML version deleted]]

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


[Rd] CRAN check for package on Sparc Solaris

2015-05-13 Thread Viechtbauer Wolfgang (STAT)
Dear All,

The metafor package currently fails CRAN checks on Sparc Solaris:

http://cran.r-project.org/web/checks/check_results_metafor.html

The problem is probably due to an unintended (= stupid) use of identical() in a 
couple tests. I have changed that to more appropriate tests using all.equal(). 
However, before I resubmit the package to CRAN, I would really like to make 
sure that the updated package passes all checks also on Sparc Solaris.

The issue/question of how to test packages on Sparc Solaris has come up before:

https://stat.ethz.ch/pipermail/r-devel/2010-September/058538.html
https://stat.ethz.ch/pipermail/r-devel/2011-November/062430.html

Unless anything has changed in the meantime, it seems like the help of kind 
volunteers is still the only option to conduct such tests. So, is there anybody 
out there with access to a Sparc machine running Solaris willing to run 'R CMD 
check --as-cran' on the updated tarball? Would be very much appreciated!

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


Re: [Rd] Unexpected failure when calling new() with unnamed arg and

2015-05-13 Thread Hervé Pagès

Thanks Martin for looking into this.  H.

On 05/13/2015 03:57 AM, Martin Maechler wrote:

Hervé Pagès hpa...@fredhutch.org
 on Tue, 12 May 2015 15:18:42 -0700 writes:



Hi,



The man page for new() suggests that if 'a' is an object with slots
slot1 and slot2 and C is a class that extends the class of 'a',
then the 2 following calls should be equivalent:



new(C, a, ...)
new(C, slot1=a@slot1, slot2=a@slot2, ...)



This is generally the case but I just ran into a situation where it's
not. In the following example the former fails while the latter works:



setClass(A, representation(slot1=numeric, slot2=logical))
setClass(B, contains=A, representation(design=formula))
setClass(C, contains=B)
a - new(A, slot1=77, slot2=TRUE)



new(C, a, design=x ~ y)  # fails
new(C, slot1=a@slot1, slot2=a@slot2, design=x ~ y)  # works



Note that new(B, a, design=x ~ y) works so the 3-level class
hierarchy is really needed in order to reproduce.



Probably related to this, I also noted that new(B) and/or new(C)
return invalid objects:



c - new(C)



validObject(c)
# Error in validObject(c) :
#  invalid class “C” object: invalid object for slot design
#  in class C: got class S4, should be or extend class formula



is(c@design, formula)
# [1] FALSE



class(c@design)
# [1] S4



Note that 'c' can be fixed:



c@design - formula(NULL)



validObject(c)
# [1] TRUE



Maybe something that the default initialize method should take care
of?



Another singularity that is maybe at the root of all of this is that
the formula S4 class is virtual:



showClass(formula)
# Virtual Class formula [package methods]
#
# Slots:
#
# Name:   .S3Class
# Class: character
#
# Extends: oldClass



so a bare call to new(formula) fails:



new(formula)
# Error in new(formula) :
#   trying to generate an object from a virtual class (formula)



Shouldn't new(formula) just return an empty S3 formula (like
formula(NULL) does), in the same way that new(integer) returns
an empty ordinary integer vector?


Interesting .. and at least worth following.

One problem and historical reason for the current setup seems
that the formula S3 class is not from 'base' but 'stats' :

R's source, src/library/methods/R/BasicClasses.R,
lines 524 ff has the following comment block

|  .OldClassesPrototypes is a list of S3 classes for which prototype
|  objects are known  reasonable.  The classes will reappear in
|  .OldClassesList, but will have been initialized first in
|  .InitBasicClasses.  NB:  the methods package will NOT set up
|  prototypes for S3 classes except those in package base and for ts
|  (and would rather not do those either).  The package that owns the
|  S3 class should have code to call setOldClass in its
|  initialization.

So, when John Chambers wrote this, he envisioned that the
'stats' package would do the correct thing for its own classes.
OTOH, as history went, the stats package was never allowed to
depend on methods.
There are many other S3 classes from 'stats' which also end up
similarly, being defined via  setOldClass() and that itself
produces a VIRTUAL class.
Also, another part of the (R source) comment above is no longer
quite accurate, e.g., data.frame is in .OldClassesPrototypes
but not in .OldClassesList ...

As I do agree that formula is much more basic than these other classes,
I'm currently looking at tweaks to the methods (and stats) code,
to get this to work as indeed - you mentioned above -  we
already allow empty S3 formula objects anyway.

... half an hour later : Indeed, I've been able to use the above information
such that  new(formula) and new(formula, y ~ x)
work.

However, your code above now --- with my changes --- would  fail :

   setClass(A, representation(slot1=numeric, slot2=logical))
   setClass(B, contains=A, representation(design=formula))
   setClass(C, contains=B)
  Error in reconcilePropertiesAndPrototype(name, slots, prototype, 
superClasses,  :
B is not eligible to be the data part of another class (must be a basic 
class or a virtual class with no slots)
  

So, I am not yet committing my changes to R-devel.
Hopefully more on this, later today.

Martin Maechler,
ETH Zurich



Thanks,
H.



   sessionInfo()
R version 3.2.0 Patched (2015-04-17 r68202)
Platform: x86_64-unknown-linux-gnu (64-bit)
Running under: Ubuntu 14.04.2 LTS



--
Hervé Pagès
Fred Hutchinson Cancer Research Center


  [..]




--
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpa...@fredhutch.org
Phone:  (206) 667-5791
Fax:(206) 667-1319

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


[Rd] Alternative for wildcard gnu extension in Makevars

2015-05-13 Thread Jan van der Laan


I have some cpp-files from another library (boost) in a subdirectory  
in my src directory (src/boost_src). I include these using the  
following two lines in my Makevars:


SOURCES = $(wildcard *.cpp boost_src/*.cpp)
OBJECTS = $(SOURCES:.cpp=.o)

However, R CMD check complains about my use of 'wildcard'. How do I  
handle this without any gnu extensions?


Thanks.
Jan

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


Re: [Rd] Alternative for wildcard gnu extension in Makevars

2015-05-13 Thread Dirk Eddelbuettel

On 13 May 2015 at 17:27, Jan van der Laan wrote:
| 
| I have some cpp-files from another library (boost) in a subdirectory  
| in my src directory (src/boost_src). I include these using the  
| following two lines in my Makevars:
| 
| SOURCES = $(wildcard *.cpp boost_src/*.cpp)
| OBJECTS = $(SOURCES:.cpp=.o)
| 
| However, R CMD check complains about my use of 'wildcard'. How do I  
| handle this without any gnu extensions?

I looked into this a few weeks (months?) ago, and it would appear that you
cannot.

I would recommend the alternative offered in Writing R Extensions: renamed it
GNUmakefile or add a SystemRequirements: GNU make.

Dirk

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

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


Re: [Rd] Alternative for wildcard gnu extension in Makevars

2015-05-13 Thread Gábor Csárdi
On Wed, May 13, 2015 at 12:05 PM, Jan van der Laan rh...@eoos.dds.nl
wrote:
[...]

 Too bad. Since it is only a handful of files, I will probably move them
 directly into the src directory and prefix them. It would have been nice to
 have been able to keep them separate.


If it is a couple of files, then you can also just list them in SOURCES (or
even just OBJECTS, with a .o suffix), and leave them where they are.

Gabor

[...]

[[alternative HTML version deleted]]

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


Re: [Rd] Alternative for wildcard gnu extension in Makevars

2015-05-13 Thread Jan van der Laan


Dirk Eddelbuettel e...@debian.org schreef:


On 13 May 2015 at 17:27, Jan van der Laan wrote:
|
| I have some cpp-files from another library (boost) in a subdirectory
| in my src directory (src/boost_src). I include these using the
| following two lines in my Makevars:
|
| SOURCES = $(wildcard *.cpp boost_src/*.cpp)
| OBJECTS = $(SOURCES:.cpp=.o)
|
| However, R CMD check complains about my use of 'wildcard'. How do I
| handle this without any gnu extensions?

I looked into this a few weeks (months?) ago, and it would appear that you
cannot.

I would recommend the alternative offered in Writing R Extensions: renamed it
GNUmakefile or add a SystemRequirements: GNU make.


Too bad. Since it is only a handful of files, I will probably move  
them directly into the src directory and prefix them. It would have  
been nice to have been able to keep them separate.


Thanks!
Jan

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


Re: [Rd] Why is the diag function so slow (for extraction)?

2015-05-13 Thread Henrik Bengtsson
As kindly pointed out to me (oh my decaying gray matter), is.object()
is better suited for this test;

$ svn diff src/library/base/R/diag.R
Index: src/library/base/R/diag.R
===
--- src/library/base/R/diag.R   (revision 68345)
+++ src/library/base/R/diag.R   (working copy)
@@ -23,9 +23,11 @@
 stop('nrow' or 'ncol' cannot be specified when 'x' is a matrix)

 if((m - min(dim(x))) == 0L) return(vector(typeof(x), 0L))
+nms - dimnames(x)
+nrow - dim(x)[1L]
 ## NB: need double index to avoid overflows.
-y - c(x)[1 + 0L:(m - 1L) * (dim(x)[1L] + 1)]
-nms - dimnames(x)
+if (is.object(x)) x - c(x)

/Henrik

On Tue, May 12, 2015 at 8:24 PM, Henrik Bengtsson
henrik.bengts...@ucsf.edu wrote:
 Along Luke's lines, would(n't) it be enough to look for existence of
 attribute 'class' to decide whether to dispatch or not, i.e. if c() is
 needed or not?  Even without .subset(), there is a remarkable
 improvement.  I think it's worth condition the code on dispatch or
 not.  For example:

 [HB-X201]{hb}: svn diff diag.R
 Index: diag.R
 ===
 --- diag.R  (revision 68345)
 +++ diag.R  (working copy)
 @@ -23,9 +23,11 @@
  stop('nrow' or 'ncol' cannot be specified when 'x' is a matrix)

  if((m - min(dim(x))) == 0L) return(vector(typeof(x), 0L))
 +nms - dimnames(x)
 +nrow - dim(x)[1L]
  ## NB: need double index to avoid overflows.
 -y - c(x)[1 + 0L:(m - 1L) * (dim(x)[1L] + 1)]
 -nms - dimnames(x)
 +if (!is.null(attr(x, class))) x - c(x)
 +y - x[1 + 0L:(m - 1L) * (nrow + 1)]
  if (is.list(nms)  !any(sapply(nms, is.null)) 
  identical((nm - nms[[1L]][seq_len(m)]), nms[[2L]][seq_len(m)]))
  names(y) - nm

 ?

 /Henrik

 On Tue, May 12, 2015 at 5:33 AM, Martin Maechler
 maech...@lynne.stat.math.ethz.ch wrote:
 Steve Bronder sbron...@stevebronder.com
 on Thu, 7 May 2015 11:49:49 -0400 writes:

  Is it possible to replace c() with .subset()?

 It would be possible, but I think entirely wrong.

 .subset() is documented to be an internal function not to be
 used lightly and more to the point it is documented to *NOT*
 dispatch at all.

 If you read and understood what Peter and Luke wrote, you'd not
 special case here:

 diag() should not work only for pure matrices, but for all
 matrix-like objects for which ``the usual methods'' work, such
 as
as.vector(.), c(.)

 That's why there has been the c(.) in there.

 You can always make code faster if you write the code so it only
 has to work in one special case .. and work there very fast.


  Example below
  
  

  library(microbenchmark)

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

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


[Rd] Reading exit code of pipe()

2015-05-13 Thread Jeroen Ooms
Is there a way to get the status code of a pipe() command? The
documentation suggests that it might be returned by close, however
this does not seem to be the case.

  con - pipe(cat /etc/passwd, r)
  stream - readLines(con, n = 10)
  err - close(con)
  print(err)

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


Re: [Rd] Reading exit code of pipe()

2015-05-13 Thread Kevin Ushey
Hi Jeroen,

I think `pipe` might just be returning the status code of the
underlying command executed; for example, I get a status code of '0'
when I test a pipe on `ls`:

conn - pipe(ls)
stream - readLines(conn)
print(close(conn))

Similarly, I get an error code if I try to `ls` a non-existent
directory (512 in my case), e.g.

conn - pipe(ls /no/path/here/sir)
stream - readLines(conn)
print(close(conn))

So maybe `cat` just doesn't set a status code, and so there's nothing
for R to forward back (ergo -- NULL)?

Kevin

On Wed, May 13, 2015 at 5:24 PM, Jeroen Ooms jeroen.o...@stat.ucla.edu wrote:
 Is there a way to get the status code of a pipe() command? The
 documentation suggests that it might be returned by close, however
 this does not seem to be the case.

   con - pipe(cat /etc/passwd, r)
   stream - readLines(con, n = 10)
   err - close(con)
   print(err)

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

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


Re: [Rd] Alternative for wildcard gnu extension in Makevars

2015-05-13 Thread Kevin Ushey
One other solution that's only a little crazy: you could have a R
function within your package that generates the appropriate (portable)
Makevars, and within the package `configure` script call that
function. For example

R --vanilla --slave -e source('R/makevars.R'); makevars()

And that 'makevars()' function could generate portable
'Makevars(.win)' files for your package.

Kevin

On Wed, May 13, 2015 at 9:08 AM, Gábor Csárdi csardi.ga...@gmail.com wrote:
 On Wed, May 13, 2015 at 12:05 PM, Jan van der Laan rh...@eoos.dds.nl
 wrote:
 [...]

 Too bad. Since it is only a handful of files, I will probably move them
 directly into the src directory and prefix them. It would have been nice to
 have been able to keep them separate.


 If it is a couple of files, then you can also just list them in SOURCES (or
 even just OBJECTS, with a .o suffix), and leave them where they are.

 Gabor

 [...]

 [[alternative HTML version deleted]]

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

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


Re: [Rd] Why is the diag function so slow (for extraction)?

2015-05-13 Thread Radford Neal
 From: Martin Maechler maech...@lynne.stat.math.ethz.ch

 diag() should not work only for pure matrices, but for all
 matrix-like objects for which ``the usual methods'' work, such
 as
as.vector(.), c(.)
 
 That's why there has been the c(.) in there.
 
 You can always make code faster if you write the code so it only
 has to work in one special case .. and work there very fast.

help(diag) gives no hint whatever that diag(x) will work for
objects that are matrix-like, but aren't actual matrices.

help(c) explicitly says that methods for it are NOT required to
convert matrices to vectors.

So you're advocating slowing down all ordinary uses of diag to
accommodate a usage that nobody thought was important enough to
actually document.

   Radford Neal

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


Re: [Rd] Alternative for wildcard gnu extension in Makevars

2015-05-13 Thread Dirk Eddelbuettel

On 13 May 2015 at 10:10, Kevin Ushey wrote:
| One other solution that's only a little crazy: you could have a R
| function within your package that generates the appropriate (portable)
| Makevars, and within the package `configure` script call that
| function. For example
| 
| R --vanilla --slave -e source('R/makevars.R'); makevars()
| 
| And that 'makevars()' function could generate portable
| 'Makevars(.win)' files for your package.

Seconded.  I do exactly that in another recent package where I needed another
verboten idiom available only in the widespread and feature-rich GNU make
but not the so-much-more constrained basic make: if statements.

See https://github.com/eddelbuettel/Rblpapi/blob/master/configure where I
need to encode 32 or 64 in the name of shared library.  By relying on Rscript
I code around the constraint of not having GNU make.   [ That is still a
non-CRAN package but for an unrelated, different reason. ]

Dirk

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

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