[Rd] R CMD check --force-biarch

2012-10-19 Thread Russell G. Almond
I'm having problems getting R CMD check to work correctly on Windows 7 (64 bit) 
in a package that uses C code.  What I want to do is to be able to pass the 
equivalent of the "--force-biarch" option to check, but this is only supported 
for INSTALL.

Background:
I'm writing a package (RNetica) which forms a link between R and a third-party 
library (Netica.dll).  The vendor supplies this library in both a 32 bit and a 
64 bit version.
Under Linux, I use configure to link against the 32 or 64 bit version of 
libnetica.a as appropriate.
Under Windows, I use configure.win to copy the 32 and 64 bit versions to 
"$R_PACKAGE_DIR/libs/i386"  and "$R_PACKAGE_DIR/libs/x64" respectively.

Installation:
This mostly works.  If I run R CMD INSTALL RNetica, R detects the configure.win 
and only builds the 64 bit version of RNetica.  [I'm not entirely clear on why 
R doesn't at least try to build both architectures. Wouldn't the default 
assumption be that the author wrote the configure.win file to handle both 
cases?]  But if I use R CMD INSTALL RNetica --force-biarch, it correctly builds 
and installs both the 32 and 64 bit versions.  I can verify that I can load my 
library and call a few functions that exercise the DLL.

Checking:
When I run R CMD check RNetica, I get the following problem in my 00install.out 
log:
> Warning: this package has a non-empty 'configure.win' file,
> so building only the main architecture
It then fails with the message:
> Error:  .onLoad failed in loadNamespace() for 'RNetica', details:
>  Call:  library.dynam("RNetica",pkgname, libname)
>  Error:  DLL 'RNetica' not found:  maybe not installed for this architecture?
Sure enough, if I check the directory RNetica.Rcheck/RNetica/libs/x64
It has Netica.dll, RNetica.dll, and symbols.rds
If I check the directory RNetica.Rcheck/RNetica/libs/i386
It only has Netica.dll (copied there by the configure.win).

If I run R CMD check RNetica --no-multiarch, this test runs correctly.
If I run R CMD check RNetica --extra-arch, this fails at the same point.

Thanks in advance for any help.



Russell Almond
alm...@acm.org
http://ralmond.net/


Russell G. Almond
12065 Cedar Bluff Trail
Tallahassee, FL 32312
1-850-668-9624
http://ralmond.net
alm...@acm.org


[[alternative HTML version deleted]]

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


[Rd] R 64bit for Windows on Windows 2012 server running Microsoft’s Hyper-V 2012?

2012-10-19 Thread Matthew Schall
Seeking confirmation/disconfirmation that R 64bit for Windows will run on 
Windows 2012 server running Microsoft’s Hyper-V 2012 server virtualization 
software and advice on building this on AMD 16 core or Intel 8 core processors 
where we want to put up a 64 core VM. We have not built this yet, we are 
seeking advice on whether R will run in this environment. 

Thank you;

Matthew Schall
matt...@catalysis.com

catalysis® 1601 East John Street ∙ Seattle, Washington  98112 
matt...@catalysis.com ∙ 206.860.2534 (direct) ∙ catalysis.com

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


[Rd] --enable-R-shlib and external BLAS/LAPACK libraries

2012-10-19 Thread Bjørn-Helge Mevik
A couple of years ago (in 2008, using R 2.7.x, I believe) I noted that
using the configure switch --enable-R-shlib when buildig R made
configure ignore any specified external LAPACK library and use the
internal one insted. I asked why, and was told it was intentional.

Now, with R 2.15.1, I see that it at least appears that this is no
longer the case.  I've run configure like this:

fast="-ip -O3 -opt-mem-layout-trans=3 -xHost -mavx"
export CC="icc"
export CFLAGS="$fast -wd188 -fp-model precise"
export F77="ifort"
export FFLAGS="$fast -fp-model precise"
export CXX="icpc"
export CXXFLAGS="$fast -fp-model precise"
export FC="ifort"
export FCFLAGS="$fast -fp-model precise"

./configure --with-blas='-mkl=parallel' --with-lapack --enable-R-shlib

(in addition, paths to the intel compilers and librareis are set up).

The output from configure says:

  Interfaces supported:  X11, tcltk
  External libraries:readline, BLAS(generic), LAPACK(in blas)
  Additional capabilities:   PNG, JPEG, TIFF, NLS, cairo
  Options enabled:   shared R library, R profiling, Java

After make install, we get a libR.so linked to MKL libraries (see below
for details).

Am I correct in assuming that this R will use the intel MKL libraries
for BLAS and LAPACK routines?  (That would be very nice, because we want
to use the fast libraries, but some of our uses need to have libR.so, so
up to now, we've had to build to versions of R.)


# ldd libR.so 
linux-vdso.so.1 =>  (0x7ff52bcf8000)
libifport.so.5 => 
/cluster/software/VERSIONS/intel-2011.10/composer_xe_2011_sp1/lib/intel64/libifport.so.5
 (0x7ff52b47d000)
libifcore.so.5 => 
/cluster/software/VERSIONS/intel-2011.10/composer_xe_2011_sp1/lib/intel64/libifcore.so.5
 (0x7ff52b238000)
libimf.so => 
/cluster/software/VERSIONS/intel-2011.10/composer_xe_2011_sp1/lib/intel64/libimf.so
 (0x7ff52ae6d000)
libsvml.so => 
/cluster/software/VERSIONS/intel-2011.10/composer_xe_2011_sp1/lib/intel64/libsvml.so
 (0x7ff52a6f3000)
libm.so.6 => /lib64/libm.so.6 (0x7ff52a45a000)
libirc.so => 
/cluster/software/VERSIONS/intel-2011.10/composer_xe_2011_sp1/lib/intel64/libirc.so
 (0x7ff52a30b000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x7ff52a0ee000)
libdl.so.2 => /lib64/libdl.so.2 (0x7ff529ee9000)
libreadline.so.6 => /lib64/libreadline.so.6 (0x7ff529ca6000)
librt.so.1 => /lib64/librt.so.1 (0x7ff529a9e000)
libmkl_intel_lp64.so => 
/cluster/software/VERSIONS/intel-2011.10/composer_xe_2011_sp1/mkl/lib/intel64/libmkl_intel_lp64.so
 (0x7ff5292b7000)
libmkl_intel_thread.so => 
/cluster/software/VERSIONS/intel-2011.10/composer_xe_2011_sp1/mkl/lib/intel64/libmkl_intel_thread.so
 (0x7ff528238000)
libmkl_core.so => 
/cluster/software/VERSIONS/intel-2011.10/composer_xe_2011_sp1/mkl/lib/intel64/libmkl_core.so
 (0x7ff5271c2000)
libiomp5.so => 
/cluster/software/VERSIONS/intel-2011.10/composer_xe_2011_sp1/lib/intel64/libiomp5.so
 (0x7ff526ecf000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x7ff526cb9000)
libintlc.so.5 => 
/cluster/software/VERSIONS/intel-2011.10/composer_xe_2011_sp1/lib/intel64/libintlc.so.5
 (0x7ff526b6a000)
libc.so.6 => /lib64/libc.so.6 (0x7ff5267d7000)
/lib64/ld-linux-x86-64.so.2 (0x00344520)
libtinfo.so.5 => /lib64/libtinfo.so.5 (0x7ff5265b6000)


-- 
Regards,
Bjørn-Helge Mevik

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


Re: [Rd] simplify2array edge case

2012-10-19 Thread Martin Maechler
> William Dunlap 
> on Thu, 11 Oct 2012 18:59:52 + writes:

> Should simplify2array(higher=TRUE) treat 1 by 1 matrices differently than 
others?
> I expected a 3-dimensional array from all of the following 3 examples, 
not just the last 2.

>> str(simplify2array(list(array(11,c(1,1)), array(21,c(1,1))), 
higher=TRUE))
> num [1:2] 11 21
>> str(simplify2array(list(array(11:13,c(3,1)), array(21:23,c(3,1))), 
higher=TRUE))
> int [1:3, 1, 1:2] 11 12 13 21 22 23
>> str(simplify2array(list(array(11:13,c(1,3)), array(21:23,c(1,3))), 
higher=TRUE))
> int [1, 1:3, 1:2] 11 12 13 21 22 23

I wrote simplify2array() in order to modularize sapply()
and have mapply() and sapply() behave identically
and because its utility seemed useful in at least on other case.
In the mean time it is also used in the parallel package's
*apply() functions.

The distinction of  1 x 1  vs  n x n  for n >= 2
i.e.,

   if (common.len == 1L) 
unlist(answer, recursive = FALSE)
else if (common.len > 1L) 
array(unlist(answer, recursive = FALSE), dim = c(common.len, 
  ...
  ... )

had really been part of sapply() at the time and hence needed to
go into simplify2array() in order to keep sapply() completely
back compatible.

Bill, have you looked into optional different behavior?

Martin Maechler, ETH Zurich

> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com

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


Re: [Rd] Rcmd_environ and R_LIBS_{USER,SITE}

2012-10-19 Thread Gavin Simpson
On Thu, 2012-10-18 at 10:18 -0500, Dirk Eddelbuettel wrote:
> Kasper,
> 
> On 18 October 2012 at 10:41, Kasper Daniel Hansen wrote:
> | I set my user libraries in .Rprofile for this very reason.  I agree it
> | is weird that .Renviron is not always read etc.
> 
> Sorry, no cigar either -- this equivalent to using files in $R_HOME/etc/ and
> is also ignored by R CMD check, which still fails in my setup as it doesn't
> find the package -- whereas any normal R session does.
> 
> Dirk

I have R_LIBS set in my Bash profile (~/.bashrc) for IIRC this very
reason. Can you do the same on Windows?

G

> 
> 
> | 
> | Kasper
> | 
> | On Thu, Oct 18, 2012 at 10:12 AM, Dirk Eddelbuettel  wrote:
> | >
> | > Keith,
> | >
> | > On 18 October 2012 at 09:14, Keith Jewell wrote:
> | > | No reply in a number of hours, so here is a suggestion from ignorance 
> :-}
> | > |
> | > | ?Startup refers to a number of other "site and user files to process for
> | >
> | > Thanks, and I know, and use those on Linux (and on 'doze when I use it).  
> My
> | > question was specifically about 'R CMD foo' which skips some of these by
> | > choice, and which Rcmd_environ appears to overcome, albeit imcompletely. I
> | > still have an issue on Windows where I cannot split my package 
> installations
> | > between those that come and go with R installations, and the others.
> | >
> | > But it is truly bizarre that I can do (on Windows)
> | >
> | >   R CMD INSTALL foo_1.2-3.tar.gz
> | >
> | > and a moment later
> | >
> | >   R CMD check foo_1.2-3.tar.gz
> | >
> | > fails in its tests and examples with "no package called 'foo'"
> | >
> | > Doing 'R CMD check --no-examples --no-tests foo_1.2-3.tar.gz' works, but 
> is
> | > less helpful as we're running the check to run those very tests...
> | >
> | > Dirk
> | >
> | >
> | > | setting environment variables" but not to Rcmd_environ. The contents of
> | > | $R_HOME/etc/Rcmd_environ seem to reflect (some of) the contents of
> | > | (some) other files.
> | > |
> | > | I have similar lines (defining library paths) in
> | > |  $R_HOME/etc/Renviron.site
> | > |
> | > | Is it correct to directly edit Rcmd_environ or should it be modified
> | > | only via other files? (A genuine question).
> | > |
> | > | On 17/10/2012 15:59, Dirk Eddelbuettel wrote:
> | > | >
> | > | > Is there a fundamental reason why I cannot set either one of
> | > | >
> | > | >## add local library path -- doesn't work either
> | > | >R_LIBS_USER="c:/opt/R-library"
> | > | >R_LIBS_SITE="c:/opt/R-library"
> | > | >
> | > | > in $R_HOME/etc/Rcmd_environ even though I can seemingly set other 
> things here?
> | > | >
> | > | > It breaks "R CMD check" for me as I prefer NOT to install packages in 
> a
> | > | > versioned path.
> | > | >
> | > | > FWIW, defaulting to a versioned path is (to this no-longer-bemused 
> user) as
> | > | > much a permenent R bug (on Windoze) as the default installation into 
> a path
> | > | > with spaces.
> | > | >
> | > | > Dirk
> | > | >
> | > |
> | > | __
> | > | R-devel@r-project.org mailing list
> | > | https://stat.ethz.ch/mailman/listinfo/r-devel
> | >
> | > --
> | > Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com
> | >
> | > __
> | > R-devel@r-project.org mailing list
> | > https://stat.ethz.ch/mailman/listinfo/r-devel
> 

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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


Re: [Rd] Rcmd_environ and R_LIBS_{USER,SITE}

2012-10-19 Thread Dirk Eddelbuettel

On 19 October 2012 at 12:39, Gavin Simpson wrote:
| On Thu, 2012-10-18 at 10:18 -0500, Dirk Eddelbuettel wrote:
| > Kasper,
| > 
| > On 18 October 2012 at 10:41, Kasper Daniel Hansen wrote:
| > | I set my user libraries in .Rprofile for this very reason.  I agree it
| > | is weird that .Renviron is not always read etc.
| > 
| > Sorry, no cigar either -- this equivalent to using files in $R_HOME/etc/ and
| > is also ignored by R CMD check, which still fails in my setup as it doesn't
| > find the package -- whereas any normal R session does.
| > 
| > Dirk
| 
| I have R_LIBS set in my Bash profile (~/.bashrc) for IIRC this very
| reason. Can you do the same on Windows?

Thanks for the suggestion, Gavin,  But well, let me count the ways 

i)   As a general principle, I prefer to minimize env variables. So on Linux,
 I prefer (and use) ~/.Rprofile and/or ~/.Renviron, or even the site-wide
 ones

ii)  Similarly, I asked for site-wide config as that can be scripted.
 Your solution, if it worked, would not (as easily) allow that.

iii) The question was specific about the intentional castration of R CMD ...
 I actually get the .libPaths() adjusted on Windows too via the method
 mentioned in i)

iv)  When I do what you helpfully suggest, .libPaths() in R shows the entry
 twice yet the braindead R CMD check  __still fails the same way__ not
 being able to load the very package tested from the location that is __not
 below__ the $R_HOME/library/ path.

This really is silly beyond words, but seemingly all by design and intentional.

Dirk




| 
| G
| 
| > 
| > 
| > | 
| > | Kasper
| > | 
| > | On Thu, Oct 18, 2012 at 10:12 AM, Dirk Eddelbuettel  
wrote:
| > | >
| > | > Keith,
| > | >
| > | > On 18 October 2012 at 09:14, Keith Jewell wrote:
| > | > | No reply in a number of hours, so here is a suggestion from ignorance 
:-}
| > | > |
| > | > | ?Startup refers to a number of other "site and user files to process 
for
| > | >
| > | > Thanks, and I know, and use those on Linux (and on 'doze when I use 
it).  My
| > | > question was specifically about 'R CMD foo' which skips some of these by
| > | > choice, and which Rcmd_environ appears to overcome, albeit 
imcompletely. I
| > | > still have an issue on Windows where I cannot split my package 
installations
| > | > between those that come and go with R installations, and the others.
| > | >
| > | > But it is truly bizarre that I can do (on Windows)
| > | >
| > | >   R CMD INSTALL foo_1.2-3.tar.gz
| > | >
| > | > and a moment later
| > | >
| > | >   R CMD check foo_1.2-3.tar.gz
| > | >
| > | > fails in its tests and examples with "no package called 'foo'"
| > | >
| > | > Doing 'R CMD check --no-examples --no-tests foo_1.2-3.tar.gz' works, 
but is
| > | > less helpful as we're running the check to run those very tests...
| > | >
| > | > Dirk
| > | >
| > | >
| > | > | setting environment variables" but not to Rcmd_environ. The contents 
of
| > | > | $R_HOME/etc/Rcmd_environ seem to reflect (some of) the contents of
| > | > | (some) other files.
| > | > |
| > | > | I have similar lines (defining library paths) in
| > | > |  $R_HOME/etc/Renviron.site
| > | > |
| > | > | Is it correct to directly edit Rcmd_environ or should it be modified
| > | > | only via other files? (A genuine question).
| > | > |
| > | > | On 17/10/2012 15:59, Dirk Eddelbuettel wrote:
| > | > | >
| > | > | > Is there a fundamental reason why I cannot set either one of
| > | > | >
| > | > | >## add local library path -- doesn't work either
| > | > | >R_LIBS_USER="c:/opt/R-library"
| > | > | >R_LIBS_SITE="c:/opt/R-library"
| > | > | >
| > | > | > in $R_HOME/etc/Rcmd_environ even though I can seemingly set other 
things here?
| > | > | >
| > | > | > It breaks "R CMD check" for me as I prefer NOT to install packages 
in a
| > | > | > versioned path.
| > | > | >
| > | > | > FWIW, defaulting to a versioned path is (to this no-longer-bemused 
user) as
| > | > | > much a permenent R bug (on Windoze) as the default installation 
into a path
| > | > | > with spaces.
| > | > | >
| > | > | > Dirk
| > | > | >
| > | > |
| > | > | __
| > | > | R-devel@r-project.org mailing list
| > | > | https://stat.ethz.ch/mailman/listinfo/r-devel
| > | >
| > | > --
| > | > Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com
| > | >
| > | > __
| > | > R-devel@r-project.org mailing list
| > | > https://stat.ethz.ch/mailman/listinfo/r-devel
| > 
| 
| -- 
| %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
|  Dr. Gavin Simpson [t] +44 (0)20 7679 0522
|  ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
|  Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
|  Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
|  UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
| %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~

Re: [Rd] R CMD check --force-biarch

2012-10-19 Thread Simon Urbanek

On Oct 18, 2012, at 12:17 PM, Russell G. Almond wrote:

> I'm having problems getting R CMD check to work correctly on Windows 7 (64 
> bit) in a package that uses C code.  What I want to do is to be able to pass 
> the equivalent of the "--force-biarch" option to check, but this is only 
> supported for INSTALL.
> 
> Background:
> I'm writing a package (RNetica) which forms a link between R and a 
> third-party library (Netica.dll).  The vendor supplies this library in both a 
> 32 bit and a 64 bit version.
> Under Linux, I use configure to link against the 32 or 64 bit version of 
> libnetica.a as appropriate.
> Under Windows, I use configure.win to copy the 32 and 64 bit versions to 
> "$R_PACKAGE_DIR/libs/i386"  and "$R_PACKAGE_DIR/libs/x64" respectively.
> 
> Installation:
> This mostly works.  If I run R CMD INSTALL RNetica, R detects the 
> configure.win and only builds the 64 bit version of RNetica.  [I'm not 
> entirely clear on why R doesn't at least try to build both architectures. 
> Wouldn't the default assumption be that the author wrote the configure.win 
> file to handle both cases?]

No, it's not configure's job to detect anything but the current architecture. 
Typically it needs to modify files so it can only modify them for one 
architecture. Your use of configure is very odd since you don't actually 
configure the package, you are copying dependencies into installation 
directories (so you can't even test it without override - that's very unusual 
and a bit questionable).


>  But if I use R CMD INSTALL RNetica --force-biarch, it correctly builds and 
> installs both the 32 and 64 bit versions.  I can verify that I can load my 
> library and call a few functions that exercise the DLL.
> 
> Checking:
> When I run R CMD check RNetica, I get the following problem in my 
> 00install.out log:
>> Warning: this package has a non-empty 'configure.win' file,
>> so building only the main architecture
> It then fails with the message:
>> Error:  .onLoad failed in loadNamespace() for 'RNetica', details:
>> Call:  library.dynam("RNetica",pkgname, libname)
>> Error:  DLL 'RNetica' not found:  maybe not installed for this architecture?
> Sure enough, if I check the directory RNetica.Rcheck/RNetica/libs/x64
> It has Netica.dll, RNetica.dll, and symbols.rds
> If I check the directory RNetica.Rcheck/RNetica/libs/i386
> It only has Netica.dll (copied there by the configure.win).
> 
> If I run R CMD check RNetica --no-multiarch, this test runs correctly.
> If I run R CMD check RNetica --extra-arch, this fails at the same point.
> 

You probably mean to use R --arch i386 to check your 32-bit version - 
architectures are normally tested separately.

Cheers,
Simon


> Thanks in advance for any help.
> 
> 
> 
> Russell Almond
> alm...@acm.org
> http://ralmond.net/
> 
> 
> Russell G. Almond
> 12065 Cedar Bluff Trail
> Tallahassee, FL 32312
> 1-850-668-9624
> http://ralmond.net
> alm...@acm.org
> 
> 
>   [[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] R CMD check --force-biarch

2012-10-19 Thread Prof Brian Ripley

On 19/10/2012 15:00, Simon Urbanek wrote:


On Oct 18, 2012, at 12:17 PM, Russell G. Almond wrote:


I'm having problems getting R CMD check to work correctly on Windows 7 (64 bit) in a 
package that uses C code.  What I want to do is to be able to pass the equivalent of the 
"--force-biarch" option to check, but this is only supported for INSTALL.


And he seems to have missed

R CMD check --help

includes

  --install-args=   command-line args to be passed to INSTALL

so I would have used

R CMD check --install-args=--force-biarch

(and when I do, it works for me).


Background:
I'm writing a package (RNetica) which forms a link between R and a third-party 
library (Netica.dll).  The vendor supplies this library in both a 32 bit and a 
64 bit version.
Under Linux, I use configure to link against the 32 or 64 bit version of 
libnetica.a as appropriate.
Under Windows, I use configure.win to copy the 32 and 64 bit versions to 
"$R_PACKAGE_DIR/libs/i386"  and "$R_PACKAGE_DIR/libs/x64" respectively.

Installation:
This mostly works.  If I run R CMD INSTALL RNetica, R detects the configure.win 
and only builds the 64 bit version of RNetica.  [I'm not entirely clear on why 
R doesn't at least try to build both architectures. Wouldn't the default 
assumption be that the author wrote the configure.win file to handle both 
cases?]


No, it's not configure's job to detect anything but the current architecture. 
Typically it needs to modify files so it can only modify them for one 
architecture. Your use of configure is very odd since you don't actually 
configure the package, you are copying dependencies into installation 
directories (so you can't even test it without override - that's very unusual 
and a bit questionable).



  But if I use R CMD INSTALL RNetica --force-biarch, it correctly builds and 
installs both the 32 and 64 bit versions.  I can verify that I can load my 
library and call a few functions that exercise the DLL.

Checking:
When I run R CMD check RNetica, I get the following problem in my 00install.out 
log:

Warning: this package has a non-empty 'configure.win' file,
so building only the main architecture

It then fails with the message:

Error:  .onLoad failed in loadNamespace() for 'RNetica', details:
Call:  library.dynam("RNetica",pkgname, libname)
Error:  DLL 'RNetica' not found:  maybe not installed for this architecture?

Sure enough, if I check the directory RNetica.Rcheck/RNetica/libs/x64
It has Netica.dll, RNetica.dll, and symbols.rds
If I check the directory RNetica.Rcheck/RNetica/libs/i386
It only has Netica.dll (copied there by the configure.win).

If I run R CMD check RNetica --no-multiarch, this test runs correctly.
If I run R CMD check RNetica --extra-arch, this fails at the same point.



You probably mean to use R --arch i386 to check your 32-bit version - 
architectures are normally tested separately.

Cheers,
Simon



Thanks in advance for any help.



Russell Almond
alm...@acm.org
http://ralmond.net/


Russell G. Almond
12065 Cedar Bluff Trail
Tallahassee, FL 32312
1-850-668-9624
http://ralmond.net
alm...@acm.org


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




--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [Rd] R 64bit for Windows on Windows 2012 server running Microsoft’s Hyper-V 2012?

2012-10-19 Thread Uwe Ligges



On 19.10.2012 01:24, Matthew Schall wrote:

Seeking confirmation/disconfirmation that R 64bit for Windows will run on 
Windows 2012 server running Microsoft’s Hyper-V 2012 server virtualization 
software and advice on building this on AMD 16 core or Intel 8 core processors 
where we want to put up a 64 core VM. We have not built this yet, we are 
seeking advice on whether R will run in this environment.


Probably yes, but untested. Those who develop the Windows part of R do 
not have access to such a system, so do not know.


Uwe Ligges




Thank you;

Matthew Schall
matt...@catalysis.com

catalysis® 1601 East John Street ∙ Seattle, Washington  98112 
matt...@catalysis.com ∙ 206.860.2534 (direct) ∙ catalysis.com

__
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] Mac and Windows binaries of rJava broken for R-devel?

2012-10-19 Thread Uwe Ligges

Thanks for letting me know.
Currently the ./2.16 Window binary tree on CRAN is still a link to 
./2.15. We will work to get binaries up within a week.


Uwe Ligges





On 19.10.2012 07:52, Hervé Pagès wrote:

Hi,

Here is a problem we see with the Mac and Windows binaries of
rJava (0.9-3) currently available on CRAN for R-devel (i.e. under
bin/macosx/leopard/contrib/2.16/ and bin/windows/contrib/2.16/):

   > library(rJava)
   > .jinit("gaggle/inst/jars/gaggleRShell.jar")
   Error in .Call("R_do_new_object", ClassDef, PACKAGE = "base") :
 "R_do_new_object" not available for .Call() for package "base"

The same code works fine with R-devel on Linux and the same version
of rJava, or with R-2.15 on all platforms and the same version of
rJava (Mac or Windows binaries installed from CRAN).

The binaries currently available on CRAN for R-devel seem to predate
some important changes in R-devel with respect to the exposure of
some .Call entry points. Could it be that those binaries just need
to be rebuilt with a more recent version of R-devel?

FWIW, we have a few packages in the development version of Bioconductor
that are affected by this issue.

Thanks in advance,
H.

 > sessionInfo()
R Under development (unstable) (2012-10-17 r60955)
Platform: i386-apple-darwin9.8.0/i386 (32-bit)

locale:
[1] en_US/en_US/en_US/C/en_US/en_US

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] rJava_0.9-3



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


[Rd] Addition of plot=F argument to termplot

2012-10-19 Thread Terry Therneau

I have a suggested addition to termplot.
We have a local mod that is used whenever none of the termplot options is quite right.  It 
is used here almost daily for Cox models in order to put the y axis on a risk scale:



fit <- coxph(Surv(time, status) ~ ph.ecog + pspline(age), data=lung)
zz <- termplot(fit, se=TRUE, plot=FALSE)

yy <- zz$age$y + outer(zz$age$se, c(0, -2, 2), '*')
matplot(zz$age$x, exp(yy), log='y', type='l', lty=c(1,2,2),
xlab="Age", ylab="Relative risk")


The return value is a list, each element of which is a dataframe.  Another use is to 
overlay the fits from two different models.
The changes to termplot.R and .Rd are small.  Since we're not supposed to add attachments 
to these emails, where to I send the updated files?


Terry T

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


Re: [Rd] Addition of plot=F argument to termplot

2012-10-19 Thread Prof Brian Ripley

On 19/10/2012 18:15, Terry Therneau wrote:

I have a suggested addition to termplot.
We have a local mod that is used whenever none of the termplot options
is quite right.  It is used here almost daily for Cox models in order to
put the y axis on a risk scale:


fit <- coxph(Surv(time, status) ~ ph.ecog + pspline(age), data=lung)
zz <- termplot(fit, se=TRUE, plot=FALSE)

yy <- zz$age$y + outer(zz$age$se, c(0, -2, 2), '*')
matplot(zz$age$x, exp(yy), log='y', type='l', lty=c(1,2,2),
 xlab="Age", ylab="Relative risk")


The return value is a list, each element of which is a dataframe.
Another use is to overlay the fits from two different models.
The changes to termplot.R and .Rd are small.  Since we're not supposed
to add attachments to these emails, where to I send the updated files?


bugs.r-project.org is the best place to lodge enhancement suggestions: 
it accepts attachments.


--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [Rd] Rcmd_environ and R_LIBS_{USER,SITE}

2012-10-19 Thread Uwe Ligges

Dirk,

if you ask R to

R CMD check foo_1.2-3.tar.gz


and the output is

"no package called 'foo'"

then something went wrong with your setup or your package.

Can we have details?

Best,
Uwe




On 19.10.2012 15:21, Dirk Eddelbuettel wrote:


On 19 October 2012 at 12:39, Gavin Simpson wrote:
| On Thu, 2012-10-18 at 10:18 -0500, Dirk Eddelbuettel wrote:
| > Kasper,
| >
| > On 18 October 2012 at 10:41, Kasper Daniel Hansen wrote:
| > | I set my user libraries in .Rprofile for this very reason.  I agree it
| > | is weird that .Renviron is not always read etc.
| >
| > Sorry, no cigar either -- this equivalent to using files in $R_HOME/etc/ and
| > is also ignored by R CMD check, which still fails in my setup as it doesn't
| > find the package -- whereas any normal R session does.
| >
| > Dirk
|
| I have R_LIBS set in my Bash profile (~/.bashrc) for IIRC this very
| reason. Can you do the same on Windows?

Thanks for the suggestion, Gavin,  But well, let me count the ways 

i)   As a general principle, I prefer to minimize env variables. So on Linux,
  I prefer (and use) ~/.Rprofile and/or ~/.Renviron, or even the site-wide
  ones

ii)  Similarly, I asked for site-wide config as that can be scripted.
  Your solution, if it worked, would not (as easily) allow that.

iii) The question was specific about the intentional castration of R CMD ...
  I actually get the .libPaths() adjusted on Windows too via the method
  mentioned in i)

iv)  When I do what you helpfully suggest, .libPaths() in R shows the entry
  twice yet the braindead R CMD check  __still fails the same way__ not
  being able to load the very package tested from the location that is __not
  below__ the $R_HOME/library/ path.

This really is silly beyond words, but seemingly all by design and intentional.

Dirk




|
| G
|
| >
| >
| > |
| > | Kasper
| > |
| > | On Thu, Oct 18, 2012 at 10:12 AM, Dirk Eddelbuettel  
wrote:
| > | >
| > | > Keith,
| > | >
| > | > On 18 October 2012 at 09:14, Keith Jewell wrote:
| > | > | No reply in a number of hours, so here is a suggestion from ignorance 
:-}
| > | > |
| > | > | ?Startup refers to a number of other "site and user files to process 
for
| > | >
| > | > Thanks, and I know, and use those on Linux (and on 'doze when I use 
it).  My
| > | > question was specifically about 'R CMD foo' which skips some of these by
| > | > choice, and which Rcmd_environ appears to overcome, albeit 
imcompletely. I
| > | > still have an issue on Windows where I cannot split my package 
installations
| > | > between those that come and go with R installations, and the others.
| > | >
| > | > But it is truly bizarre that I can do (on Windows)
| > | >
| > | >   R CMD INSTALL foo_1.2-3.tar.gz
| > | >
| > | > and a moment later
| > | >
| > | >   R CMD check foo_1.2-3.tar.gz
| > | >
| > | > fails in its tests and examples with "no package called 'foo'"
| > | >
| > | > Doing 'R CMD check --no-examples --no-tests foo_1.2-3.tar.gz' works, 
but is
| > | > less helpful as we're running the check to run those very tests...
| > | >
| > | > Dirk
| > | >
| > | >
| > | > | setting environment variables" but not to Rcmd_environ. The contents 
of
| > | > | $R_HOME/etc/Rcmd_environ seem to reflect (some of) the contents of
| > | > | (some) other files.
| > | > |
| > | > | I have similar lines (defining library paths) in
| > | > |  $R_HOME/etc/Renviron.site
| > | > |
| > | > | Is it correct to directly edit Rcmd_environ or should it be modified
| > | > | only via other files? (A genuine question).
| > | > |
| > | > | On 17/10/2012 15:59, Dirk Eddelbuettel wrote:
| > | > | >
| > | > | > Is there a fundamental reason why I cannot set either one of
| > | > | >
| > | > | >## add local library path -- doesn't work either
| > | > | >R_LIBS_USER="c:/opt/R-library"
| > | > | >R_LIBS_SITE="c:/opt/R-library"
| > | > | >
| > | > | > in $R_HOME/etc/Rcmd_environ even though I can seemingly set other 
things here?
| > | > | >
| > | > | > It breaks "R CMD check" for me as I prefer NOT to install packages 
in a
| > | > | > versioned path.
| > | > | >
| > | > | > FWIW, defaulting to a versioned path is (to this no-longer-bemused 
user) as
| > | > | > much a permenent R bug (on Windoze) as the default installation 
into a path
| > | > | > with spaces.
| > | > | >
| > | > | > Dirk
| > | > | >
| > | > |
| > | > | __
| > | > | R-devel@r-project.org mailing list
| > | > | https://stat.ethz.ch/mailman/listinfo/r-devel
| > | >
| > | > --
| > | > Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com
| > | >
| > | > __
| > | > R-devel@r-project.org mailing list
| > | > https://stat.ethz.ch/mailman/listinfo/r-devel
| >
|
| --
| %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
|  Dr. Gavin Simpson [t] +44 (0)20 7679 0522
|  ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
|  Pearso

[Rd] customize building package vignettes

2012-10-19 Thread Yihui Xie
Hi,

I mentioned this at useR! 2012 but I guess the relevant R core members
were not there (presumably Fritz, Duncan and Brian), so I'm making
this wishlist again:

Currently package vignettes have to be processed through Sweave, which
is too restrictive since several add-on packages aiming to improve or
extend Sweave have appeared (e.g. cacheSweave, pgfSweave, R.rsp,
highlight, knitr, ...). The common hack that package authors use, as
far as I can see, is the Makefile. One example is at
https://github.com/yihui/knitr/blob/master/inst/doc/Makefile

Although this hack works well for some cases, it is potentially
problematic in two aspects:

1. The vignette has to be processed by Sweave anyway, and it is a
waste of time because it will be processed by another package later in
the Makefile;
2. The syntax of the vignette may not be compatible with Sweave, so
Sweave can run into errors (e.g. < 5) TRUE else
FALSE>>=); there is a darker hack for this but we really hate hacks;

Vignettes are extremely valuable resources for R packages, and I
really wish there could be a natural way for package developers to
compile vignettes using a customized routine. For example, introduce a
build.R under inst/doc or vignettes/ which takes care of building the
vignettes; if it does not exist, just call Sweave() as the default
approach.

Here is one discussion about a package on Bioconductor which should
strengthen my proposal:
http://grokbase.com/t/r/bioc-devel/129vxrxabm/to-use-knitr-how-to-write-the-right-makefile-for-bioconductor-devel-and-released-branch

There are further advantages if package authors are not restricted to
Sweave; the corrplot package is an example of building an HTML
vignette which could be easier for authors who are not familiar with
LaTeX and they can also distribute the vignette on the web easily.
See:

if (!require('corrplot')) install.packages('corrplot')
help(package = 'corrplot', help_type = 'html')

I have talked to some R core and Bioc core members offline, and this
seems to be a reasonable request. I will be grateful if this can be
considered and implemented in the future.

Regards,
Yihui
--
Yihui Xie 
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA

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


[Rd] setting option in function

2012-10-19 Thread Charles Geyer
is it possible to set an option inside a function ((I want to set
na.action = na.fail) and have the previous state restored if there is
an error so that the function doesn't change the option behind the
user's back?

Sorry if this has been answered before, but this subject is hard to Google.

--
Charles Geyer
Professor, School of Statistics
University of Minnesota
char...@stat.umn.edu

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


Re: [Rd] Rcmd_environ and R_LIBS_{USER,SITE}

2012-10-19 Thread Dirk Eddelbuettel

Hi Uwe,

On 19 October 2012 at 19:25, Uwe Ligges wrote:
| Dirk,
| 
| if you ask R to
| 
| R CMD check foo_1.2-3.tar.gz
| 
| 
| and the output is
| 
| "no package called 'foo'"
| 
| then something went wrong with your setup or your package.

That is not what I said, or tried to say. My issue is that the _tests_ and
_examples_ fail.
 
| Can we have details?

Sure -- See below.  Cut and pasted from an Emacs buffer on Windoze as
evidenved by the U:\ directory at mingw id shown. Emacs has no role here, it
also fails the same way in a normal DOS prompt.


u:\R\src>R CMD check foo_0.2.2.tar.gz
R CMD check foo_0.2.2.tar.gz
* using log directory 'u:/R/src/foo.Rcheck'
* using R version 2.15.1 (2012-06-22)
* using platform: x86_64-pc-mingw32 (64-bit)
* using session charset: ISO8859-1
* checking for file 'foo/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'foo' version '0.2.2'
* 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 whether package 'foo' can be installed ... [34s] OK
* checking installed package size ... OK
* checking package directory ... OK
* checking for portable file names ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* loading checks for arch 'i386'
** 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
* loading checks for arch 'x64'
** 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 for unstated dependencies in R code ... OK
* 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 contents of 'data' directory ... OK
* checking data for non-ASCII characters ... OK
* checking data for ASCII and uncompressed saves ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking line endings in Makefiles ... OK
* checking for portable compilation flags in Makevars ... OK
* checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK
* checking compiled code ... OK
* checking examples ...
** running examples for arch 'i386' ... ERROR
Running examples in 'foo-Ex.R' failed
The error occurred in:


R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-pc-mingw32/i386 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> pkgname <- "foo"
> source(file.path(R.home("share"), "R", "examples-header.R"))
> options(warn = 1)
> options(pager = "console")
> library('foo')
Error in library("foo") : there is no package called 'foo'
Execution halted
** running examples for arch 'x64' ... ERROR
Running examples in 'foo-Ex.R' failed
The error occurred in:


R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-pc-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to ci

Re: [Rd] setting option in function

2012-10-19 Thread Thomas Lumley
old_options <- options(na.action=na.fail)
on.exit(options(old_options))

You can also use this to define a wrapper that executes an expression
using special options

withOptions<-function(optlist,expr){
oldopt<-options(optlist)
on.exit(options(oldopt))
expr<-substitute(expr)
eval.parent(expr)
}


-thomas



On Sat, Oct 20, 2012 at 10:35 AM, Charles Geyer  wrote:
> is it possible to set an option inside a function ((I want to set
> na.action = na.fail) and have the previous state restored if there is
> an error so that the function doesn't change the option behind the
> user's back?
>
> Sorry if this has been answered before, but this subject is hard to Google.
>
> --
> Charles Geyer
> Professor, School of Statistics
> University of Minnesota
> char...@stat.umn.edu
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 
Thomas Lumley
Professor of Biostatistics
University of Auckland

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


Re: [Rd] Mac and Windows binaries of rJava broken for R-devel?

2012-10-19 Thread Hervé Pagès

On 10/19/2012 10:02 AM, Uwe Ligges wrote:

Thanks for letting me know.
Currently the ./2.16 Window binary tree on CRAN is still a link to
./2.15. We will work to get binaries up within a week.


Sounds good. Thanks!  H.



Uwe Ligges





On 19.10.2012 07:52, Hervé Pagès wrote:

Hi,

Here is a problem we see with the Mac and Windows binaries of
rJava (0.9-3) currently available on CRAN for R-devel (i.e. under
bin/macosx/leopard/contrib/2.16/ and bin/windows/contrib/2.16/):

   > library(rJava)
   > .jinit("gaggle/inst/jars/gaggleRShell.jar")
   Error in .Call("R_do_new_object", ClassDef, PACKAGE = "base") :
 "R_do_new_object" not available for .Call() for package "base"

The same code works fine with R-devel on Linux and the same version
of rJava, or with R-2.15 on all platforms and the same version of
rJava (Mac or Windows binaries installed from CRAN).

The binaries currently available on CRAN for R-devel seem to predate
some important changes in R-devel with respect to the exposure of
some .Call entry points. Could it be that those binaries just need
to be rebuilt with a more recent version of R-devel?

FWIW, we have a few packages in the development version of Bioconductor
that are affected by this issue.

Thanks in advance,
H.

 > sessionInfo()
R Under development (unstable) (2012-10-17 r60955)
Platform: i386-apple-darwin9.8.0/i386 (32-bit)

locale:
[1] en_US/en_US/en_US/C/en_US/en_US

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] rJava_0.9-3



--
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...@fhcrc.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] Change in the RNG implementation?

2012-10-19 Thread Hervé Pagès

Hi,

Looks like the implementation of random number generation changed in
R-devel with respect to R-2.15.1.

With R-2.15.1:

  > set.seed(33)
  > sample(49821115, 10)
   [1] 22217252 19661919 24099911 45779422 42043111 25774933 21778053 
17098516

   [9]   773073  5878451

With recent R-devel:

  > set.seed(33)
  > sample(49821115, 10)
   [1] 22217252 19661919 24099912 45779425 42043115 25774935 21778056 
17098518

   [9]   773073  5878452

This is on a 64-bit Ubuntu system.

Is this change intended? I didn't see anything in the NEWS file.

A potential problem with this is that it will break unit tests
for algorithms that make use of RNG.

Another more practical problem (at least for me) is the following:
Bioconductor package maintainers are sometimes working hard on the
development version of their package to improve the performance of
some key functions. Comparing performance between BioC release
(based on R-2.15) and devel (based on R-devel) often requires big
input data that is randomly generated, because it's easiest than
working with real data. Typically a small script is written that
takes care of loading the required packages, generating the input
data, and running a simple analysis. The same script is sourced in
R-2.15 and R-devel, and performance and results are compared.

Not being able to generate exactly the same input in the script is
a problem. It can be worked around by generating the input once,
serializing it, and use load() in the script, but that makes things
more complicated and the script is not a standalone script anymore
(cannot be passed around without also passing around the big .rda
file).

Thanks,
H.

--
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...@fhcrc.org
Phone:  (206) 667-5791
Fax:(206) 667-1319

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


Re: [Rd] setting option in function

2012-10-19 Thread William Dunlap
Hi Charley,

You can use the idiom
   oldNaAction <- options(na.action=na.fail)
   on.exit(options(oldNaAction))
or the slightly safer (protected again an interrupt
between the first two lines or an error calling options
to set them)
   oldNaAction <- getOption("na.action")
   on.exit(options(oldNaAction))
   options(na.action=na.fail)
.
I prefer to bury it in a function like
   withOption <- function(optionList, expr) {
   stopifnot(is.list(optionList))
   oldOptionList <- options(names(optionList))
   on.exit(options(oldOptionList))
   options(optionList)
   expr # lazily evaluate now
   }
used as
  > getOption("na.action")
  [1] "na.omit"
  > withOption(list(na.action = "na.fail"), lm(y~x, 
data=data.frame(x=c(1,2,NA), y=1:3)))
  Error in na.fail.default(list(y = 1:3, x = c(1, 2, NA))) : 
missing values in object
  > withOption(list(na.action = "na.exclude"), lm(y~x, 
data=data.frame(x=c(1,2,NA), y=1:3)))  

  Call:
  lm(formula = y ~ x, data = data.frame(x = c(1, 2, NA), y = 1:3))
  
  Coefficients:
  (Intercept)x  
01  

  > getOption("na.action")
  [1] "na.omit"

The function makes it  less painful to use the safer version and you
don't have to worry about a subsequent call to on.exit()
wiping out the current request to do something on exiting
the function.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


> -Original Message-
> From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] On 
> Behalf
> Of Charles Geyer
> Sent: Friday, October 19, 2012 2:35 PM
> To: r-devel@r-project.org
> Subject: [Rd] setting option in function
> 
> is it possible to set an option inside a function ((I want to set
> na.action = na.fail) and have the previous state restored if there is
> an error so that the function doesn't change the option behind the
> user's back?
> 
> Sorry if this has been answered before, but this subject is hard to Google.
> 
> --
> Charles Geyer
> Professor, School of Statistics
> University of Minnesota
> char...@stat.umn.edu
> 
> __
> 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] setting option in function

2012-10-19 Thread Charles Geyer
That was easy.  Thanks.  That will fix a problem a lot of users are having
with the aster package.  If users have NA's in their data, then they almost
certainly don't know what they are doing (with aster).

On Fri, Oct 19, 2012 at 5:10 PM, Thomas Lumley  wrote:

> old_options <- options(na.action=na.fail)
> on.exit(options(old_options))
>
> You can also use this to define a wrapper that executes an expression
> using special options
>
> withOptions<-function(optlist,expr){
> oldopt<-options(optlist)
> on.exit(options(oldopt))
> expr<-substitute(expr)
> eval.parent(expr)
> }
>
>
> -thomas
>
>
>
> On Sat, Oct 20, 2012 at 10:35 AM, Charles Geyer 
> wrote:
> > is it possible to set an option inside a function ((I want to set
> > na.action = na.fail) and have the previous state restored if there is
> > an error so that the function doesn't change the option behind the
> > user's back?
> >
> > Sorry if this has been answered before, but this subject is hard to
> Google.
> >
> > --
> > Charles Geyer
> > Professor, School of Statistics
> > University of Minnesota
> > char...@stat.umn.edu
> >
> > __
> > R-devel@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
>
>
>
> --
> Thomas Lumley
> Professor of Biostatistics
> University of Auckland
>



-- 
Charles Geyer
Professor, School of Statistics
University of Minnesota
char...@stat.umn.edu

[[alternative HTML version deleted]]

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


Re: [Rd] Change in the RNG implementation?

2012-10-19 Thread Duncan Murdoch

On 12-10-19 7:04 PM, Hervé Pagès wrote:

Hi,

Looks like the implementation of random number generation changed in
R-devel with respect to R-2.15.1.

With R-2.15.1:

> set.seed(33)
> sample(49821115, 10)
 [1] 22217252 19661919 24099911 45779422 42043111 25774933 21778053
17098516
 [9]   773073  5878451

With recent R-devel:

> set.seed(33)
> sample(49821115, 10)
 [1] 22217252 19661919 24099912 45779425 42043115 25774935 21778056
17098518
 [9]   773073  5878452

This is on a 64-bit Ubuntu system.

Is this change intended? I didn't see anything in the NEWS file.

A potential problem with this is that it will break unit tests
for algorithms that make use of RNG.

Another more practical problem (at least for me) is the following:
Bioconductor package maintainers are sometimes working hard on the
development version of their package to improve the performance of
some key functions. Comparing performance between BioC release
(based on R-2.15) and devel (based on R-devel) often requires big
input data that is randomly generated, because it's easiest than
working with real data. Typically a small script is written that
takes care of loading the required packages, generating the input
data, and running a simple analysis. The same script is sourced in
R-2.15 and R-devel, and performance and results are compared.

Not being able to generate exactly the same input in the script is
a problem. It can be worked around by generating the input once,
serializing it, and use load() in the script, but that makes things
more complicated and the script is not a standalone script anymore
(cannot be passed around without also passing around the big .rda
file).

Thanks,
H.



I think it was mentioned in the NEWS:

 \code{sample.int()} has some support for  \eqn{n \ge
 2^{31}}{n >= 2^31}: see its help for the limitations.

 A different algorithm is used for \code{(n, size, replace = FALSE,
 prob = NULL)} for \code{n > 1e7} and \code{size <= n/2}.  This
 is much faster and uses less memory, but does give different results.

I don't think the old algorithm is available, but perhaps it could be 
made available by an optional parameter.


Duncan Murdoch

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


Re: [Rd] Wait for user input with readline()

2012-10-19 Thread torekp
jcharlto,

Thank you thank you thank you, you just saved me about 7.9 hours!



--
View this message in context: 
http://r.789695.n4.nabble.com/Wait-for-user-input-with-readline-tp3054517p4646826.html
Sent from the R devel mailing list archive at Nabble.com.

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