Re: [Rd] gfortran optimization problems

2008-10-25 Thread Simone Giannerini
Dave,

yes, we have experienced different results in different platforms, the
problem was partly due to the different versions
of gfortran installed across platforms, are you using the same version for
all the platforms?
Clearly, gfortran is undergoing rapid changes so that the results might vary
a lot across versions. You might want to contact the developers should you
find out a compiler bug.

Kind regards

Simone


On Sat, Oct 25, 2008 at 12:53 AM, Dave Roberts <[EMAIL PROTECTED]> wrote:

> Colleagues,
>
> I have a routine in package labdsv that calls a FORTRAN subroutine.
> Recently, I was informed that it sometimes gives different results on a PC
> and Mac, and that the PC version is clearly wrong.  I tested it on linux
> (because I don't have a PC), and I get the same (incorrect) behavior as the
> PC.
>
> Simply by inserting debug WRITE statements in the FORTRAN I would get
> different, and correct, results, so I assumed it was an optimization error.
>
> So,
>
> 1) R CMD SHLIB duleg.fdoes not work, and produces bogus code
>
> however,
>
> 2) gfortran -c alt_duleg.f
>   gcc -O -std=gnu99 -shared -L/usr/local/lib -o alt_duleg.so
>alt_duleg.o -lgfortran -lm -lgcc_s
>
> does work (note the -O low optimization).  Otherwise the gcc command is
> identical to the one produced by R CMD SHLIB.
>
> Has anyone else seen this?  Is there a simple way to have my package
> enforce no optimization so others don't struggle with this?  As far as I
> know the same code worked under g77.
>
> Thanks, Dave Roberts
> --
> 
> David W. Roberts office 406-994-4548
> Professor and Head  FAX 406-994-3190
> Department of Ecology email [EMAIL PROTECTED]
> Montana State University
> Bozeman, MT 59717-3460
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



-- 
__

Simone Giannerini
Dipartimento di Scienze Statistiche "Paolo Fortunati"
Universita' di Bologna
Via delle belle arti 41 - 40126  Bologna,  ITALY
Tel: +39 051 2098262  Fax: +39 051 232153
http://www2.stat.unibo.it/giannerini/
__

[[alternative HTML version deleted]]

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


[Rd] pairwise.wilcox.test for paired samples

2008-10-25 Thread Matthias Kohl

Dear R Core,

pairwise.wilcox.test does not handle "paired = TRUE" correctly; e.g.

set.seed(13)
x <- rnorm(20)
g <- c(rep(1, 10), rep(2, 10))
wilcox.test(x ~ g)$p.value # 0.075
pairwise.wilcox.test(x, g)$p.value # 0.075, o.k
wilcox.test(x ~ g, paired = TRUE)$p.value # 0.105
pairwise.wilcox.test(x, g, paired = TRUE)$p.value # 0.075, wrong


The line
   wilcox.test(xi, xj, ...)$p.value

should read
  wilcox.test(xi, xj, paired = paired, ...)$p.value

Best regards,
Matthias


my sessionInfo:
R version 2.8.0 Patched (2008-10-23 r46779)
i686-pc-linux-gnu

locale:
LC_CTYPE=de_DE.UTF-8;LC_NUMERIC=C;LC_TIME=de_DE.UTF-8;LC_COLLATE=de_DE.UTF-8;LC_MONETARY=C;LC_MESSAGES=de_DE.UTF-8;LC_PAPER=de_DE.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=de_DE.UTF-8;LC_IDENTIFICATION=C

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

--
Dr. Matthias Kohl
www.stamats.de

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


[Rd] R echoes integer literals incorrectly, under certain conditions (PR#13204)

2008-10-25 Thread milbo
Full_Name: Stephen Milborrow
Version: R 2.8.0
OS: Windows XP
Submission from: (NULL) (81.159.65.46)


Under certain conditions, R 2.8.0 incorrectly echoes integer literals without
the "L" suffix.  R 2.7.2 is ok.

To reproduce, create two files as follows:
a.R containing: source("b.R", echo=TRUE)
b.R containing: x <- 1L

Now execute: Rterm --vanilla --silent  sessionInfo()
R version 2.8.0 (2008-10-20) 
i386-pc-mingw32 

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

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

www.milbo.users.sonic.net

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


[Rd] 0 ^ NaN == Inf, why?

2008-10-25 Thread Stephen Milborrow
In R, 0 ^ NaN yields Inf.  I would have expected NaN or perhaps 0. Is this 
behaviour intended?

>sessionInfo()
R version 2.8.0 (2008-10-20)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

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

Steve Milborrow
www.milbo.users.sonic.net

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


Re: [Rd] R echoes integer literals incorrectly, under certain conditions (PR#13204)

2008-10-25 Thread Duncan Murdoch

On 25/10/2008 10:45 AM, [EMAIL PROTECTED] wrote:

Full_Name: Stephen Milborrow
Version: R 2.8.0
OS: Windows XP
Submission from: (NULL) (81.159.65.46)


Under certain conditions, R 2.8.0 incorrectly echoes integer literals without
the "L" suffix.  R 2.7.2 is ok.

To reproduce, create two files as follows:
a.R containing: source("b.R", echo=TRUE)
b.R containing: x <- 1L

Now execute: Rterm --vanilla --silent 

It works fine for me.  Could you try changing b.R to contain a comment, e.g.

x <- # a comment
 1L

and let us know what you see in the two cases?  I'm guessing you won't 
see the comment being echoed when you source a.R because for some reason 
your system is deparsing instead of going back to the source to read it, 
but I don't know what'll happen with b.R.


Duncan Murdoch



sessionInfo()
R version 2.8.0 (2008-10-20) 
i386-pc-mingw32 


locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

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


www.milbo.users.sonic.net

__
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 echoes integer literals incorrectly, under certain conditions (PR#13205)

2008-10-25 Thread murdoch
On 25/10/2008 10:45 AM, [EMAIL PROTECTED] wrote:
> Full_Name: Stephen Milborrow
> Version: R 2.8.0
> OS: Windows XP
> Submission from: (NULL) (81.159.65.46)
> 
> 
> Under certain conditions, R 2.8.0 incorrectly echoes integer literals without
> the "L" suffix.  R 2.7.2 is ok.
> 
> To reproduce, create two files as follows:
> a.R containing: source("b.R", echo=TRUE)
> b.R containing: x <- 1L
> 
> Now execute: Rterm --vanilla --silent  This echoes:x <- 1
> It should echo: x <- 1L
> 
> This behaviour does not occur if you source("b.R") directly from the R command
> prompt, or if you use R 2.7.2.

It works fine for me.  Could you try changing b.R to contain a comment, e.g.

x <- # a comment
  1L

and let us know what you see in the two cases?  I'm guessing you won't 
see the comment being echoed when you source a.R because for some reason 
your system is deparsing instead of going back to the source to read it, 
but I don't know what'll happen with b.R.

Duncan Murdoch
> 
>> sessionInfo()
> R version 2.8.0 (2008-10-20) 
> i386-pc-mingw32 
> 
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
> States.1252;LC_MONETARY=English_United
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
> 
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base 
> 
> www.milbo.users.sonic.net
> 
> __
> 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] pairwise.wilcox.test for paired samples

2008-10-25 Thread Peter Dalgaard

Matthias Kohl wrote:

Dear R Core,

pairwise.wilcox.test does not handle "paired = TRUE" correctly; e.g.





The line
   wilcox.test(xi, xj, ...)$p.value

should read
  wilcox.test(xi, xj, paired = paired, ...)$p.value


Yes, fixed now. Thanks.

-pd

--
   O__   Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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


Re: [Rd] 0 ^ NaN == Inf, why?

2008-10-25 Thread John Chambers
Stephen Milborrow wrote:
> In R, 0 ^ NaN yields Inf.  I would have expected NaN or perhaps 0. Is this 
> behaviour intended?
>   
Well, it certainly follows from the implementation.  In the R_pow C routine,

double R_pow(double x, double y) /* = x ^ y */
{
if(x == 1. || y == 0.)
  return(1.);
if(x == 0.) {
  if(y > 0.) return(0.);
  /* y < 0 */ return(R_PosInf);
}

It does seem, however, that NaN is the logical result here, which I 
think results from changing the implementation to:

if(x == 0.) {
  if(y > 0.) return(0.);
  else if(y < 0) return(R_PosInf);
  else return(y); /* NA or NaN, we assert */
}

Other things being equal, `^` should follow the C pow() function for 
numeric arguments.  After writing pow() as an R function that calls this 
C function:

 > pow(0,NaN)
[1] NaN
 > pow(0,NA)
[1] NA
 > pow(0,0)
[1] 1

The second example presumably falls out because the C function returns 
its second argument if that is a NaN (which a numeric NA is, in C but 
not in R).  The modified code in R_pow mimics that behavior.

Along the line, notice that both R_pow and pow give 0^0 as 1.  (Just at 
a guess, C might give 0^-0 as Inf, but I don't know how to test that in R.)

Other opinions?

John


>   
>> sessionInfo()
>> 
> R version 2.8.0 (2008-10-20)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
> States.1252;LC_MONETARY=English_United 
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
>
> Steve Milborrow
> www.milbo.users.sonic.net
>
> __
> 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] 0 ^ NaN == Inf, why?

2008-10-25 Thread John Chambers

A small PS:

John Chambers wrote:


Along the line, notice that both R_pow and pow give 0^0 as 1.  (Just at 
a guess, C might give 0^-0 as Inf, but I don't know how to test that in R.)
  
I tried a little harder, and apparently the guess is wrong.  It seems 
that pow(0, -0) is 1 in C.   Would seem better to either have pow(0,0) 
and pow(0,-0) both be NaN or else 1 and Inf, but ...

John


  
__

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] Dynamic linking to binary code from other packages??

2008-10-25 Thread Charles Danko
Dear R-devel,

I am writing a package that needs some C++ functions from an external
SDK (Affymetrix fusion).  The same functions are already compiled into
another package (affxparser).

Can I dynamically link to the compiled code in affxparser, rather than
re-compiling these separately into my package?

Not a lot of experience on this subject!

Thanks,
Charles

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


Re: [Rd] Dynamic linking to binary code from other packages??

2008-10-25 Thread Dirk Eddelbuettel

On 25 October 2008 at 16:05, Charles Danko wrote:
| Dear R-devel,
| 
| I am writing a package that needs some C++ functions from an external
| SDK (Affymetrix fusion).  The same functions are already compiled into
| another package (affxparser).
| 
| Can I dynamically link to the compiled code in affxparser, rather than
| re-compiling these separately into my package?

Yes.  Working examples are lme4 using Matrix.  This is documented in the 'R
Extensions' manual.  

| Not a lot of experience on this subject!

I don't think it is the easiest way around.  Maybe start by 'just'
recompiling and relinking.

Dirk

-- 
Three out of two people have difficulties with fractions.

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


[Rd] Compilation error when X11 is off (PR#13206)

2008-10-25 Thread ybryukhov
Full_Name: Yegor Bryukhov
Version: 2.8.0
OS: Linux
Submission from: (NULL) (69.22.221.161)


in file src/platform.c line 1657 - a semi-colon is missing for the case when X11
is turned off

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


[Rd] R CMD Rd2dvi (PR#13200)

2008-10-25 Thread Rowan . Haigh
Hello,
I can build packages with R-2.8.0 but I cannot run the code:
R CMD Rd2dvi --pdf --no-clean 
=20
Error message:
.: Can't open C:/Apps/R/R280/share/sh/dcf.sh: No such file or directory
The system cannot find the path specified.
=20
The above code works fine in R-2.7.2.
=20
Comparing the bash script Rd2dvi.sh between R-2.7.2 and R-2.8.0 makes me
think that the script is incorrectly determining my system to be UNIX
rather than WINDOWS. I tried the option --os=3Dwindows without any
success.
=20
Good luck.=20
Cheers, Rowan
=20
Sys.getenv()

ADMB_HOMEC:\Apps\ADMB=09
ALLUSERSPROFILE  C:\Documents and Settings\All Users=09
APPDATA  C:\Documents and Settings\haighr\Application Data=09
CommonProgramFiles   C:\Program Files\Common Files=09
COMPUTERNAME PAC03470=09
ComSpec  C:\WINDOWS\system32\cmd.exe=09
DEFLOGDIRC:\Documents and Settings\All Users\Application
Data\McAfee\DesktopProtection=09
FP_NO_HOST_CHECK NO=09
GFORTRAN_STDERR_UNIT -1=09
GFORTRAN_STDOUT_UNIT -1=09
HOME E:\Temp\MyDocs=09
HOMEDRIVEC:=09
HOMEPATH \Documents and Settings\haighr=09
HOMESHARE\\pacpbsfp1\HaighR$=09
LOGONSERVER  \\PACIOSADC1=09
NUMBER_OF_PROCESSORS 2=09
OS   Windows_NT=09
PATH
E:\Archive\Bat;C:\Apps\R\Rtools\bin;C:/Apps/Dev-Cpp/bin;C:\Apps\MiKTeX\m
iktex\bin;C:\Apps\R\Rtools\perl\bin;C:\Apps\R\Rtools\MinGW\bin;C:\Apps\P
ython25\Scripts;C:\Apps\Ora81\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WIND
OWS\System32\Wbem;C:\Apps\UltraEdit\=09
PATHEXT  .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH=09
PROCESSOR_ARCHITECTURE   x86=09
PROCESSOR_IDENTIFIER x86 Family 6 Model 15 Stepping 6, GenuineIntel=09
PROCESSOR_LEVEL  6=09
PROCESSOR_REVISION   0f06=09
ProgramFiles C:\Program Files=09
R_HOME   C:\Apps\R\R280=09
R_LIBS_USER  E:\Temp\MyDocs/R/win-library/2.8=09
R_USER   E:\Temp\MyDocs=09
SESSIONNAME  Console=09
SystemDrive  C:=09
SystemRoot   C:\WINDOWS=09
TEMP C:\Temp\HaighR=09
TMP  C:\Temp\HaighR=09
USERDNSDOMAINPAC.DFO-MPO.CA=09
USERDOMAIN   PAC=09
USERNAME HaighR=09
USERPROFILE  C:\Documents and Settings\haighr=09
VSEDEFLOGDIR C:\Documents and Settings\All Users\Application
Data\McAfee\DesktopProtection=09
windir   C:\WINDOWS=09
=20

Rowan Haigh
Research Biologist, Groundfish Section
Marine Ecosystems & Aquaculture Division
Fisheries and Oceans Canada
Pacific Biological Station, Nanaimo, BC  V9T 6N7
Tel. +1 250-756-7123  fac simile +1 250-756-7053
Email [EMAIL PROTECTED]

=20

[[alternative HTML version deleted]]

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


[Rd] write.csv(..., col.names = FALSE) (PR#13202)

2008-10-25 Thread stefan . albrecht
Full_Name: Stefan Albrecht
Version: 2.7.2 (and 2.8.0)
OS: Windows NT
Submission from: (NULL) (194.127.8.17)


Dear R Debug-Team,

in write.csv() it is not possible to set both
row.names = FALSE, col.names = FALSE
since the col.names = FALSE gets overwritten:

> write.csv
function (...) 
{
Call <- match.call(expand.dots = TRUE)
for (argname in c("col.names", "sep", "dec", "qmethod")) if
(!is.null(Call[[argname]])) 
warning(gettextf("attempt to set '%s' ignored", argname), 
domain = NA)
rn <- eval.parent(Call$row.names)
Call$col.names <- if (is.logical(rn) && !rn) 
TRUE
else NA
Call$sep <- ","
Call$dec <- "."
Call$qmethod <- "double"
Call[[1]] <- as.name("write.table")
eval.parent(Call)
}

> 

This is not documented and should be changed, as it is an unintended reaction.

With many thanks and best regards,
Stefan

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


[Rd] Errors in R CMD check for R 2.8.0

2008-10-25 Thread dxc13

useR's,

I get these 2 errors when I run "R CMD check" on my package, and I cannot
figure out how to get around them.  Does anyone have any ideas?  If it is of
any help, I use Windows XP.
...
* checking replacement functions  OK
* checking foreign function calls ... OK
* checking R code for possible problems ... NOTE
Error in inDL(x, as.logical(local), as.logical(now), ...): unable to load
shared library 'c:/Progra~1/R/R-2.8.0/library/tcltk/libs/tcltk.dll':
LoadLibrary failure: The specified procedure could not be found.

Error: .onLoad failed in 'loadNamespace' for 'tcltk'

* Checking .Rd files ... OK

* checking data for non-ASCII characters ... OK
* creating kzs-Ex.R ... OK
* checking examples ... ERROR
Running examples in 'kzs-Ex.R' failed.

I have no idea how to solve the first problem with references the tcltk
package and I do not know why my examples won't run.   Any help is
appreciated.

dxc13
-- 
View this message in context: 
http://www.nabble.com/Errors-in-R-CMD-check-for-R-2.8.0-tp20150565p20150565.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