Re: [Rd] Too long pathname in bitmap() crashes R on WinXP

2007-03-31 Thread Henrik Bengtsson
Thanks. /Henrik

On 3/31/07, Prof Brian Ripley [EMAIL PROTECTED] wrote:
 It is also possible to trigger this on Unix: a buffer in postscript() is
 PATH_MAX when it should be 2*PATH_MAX + 2.

 I'll fix this in 2.5.0 alpha (there is also a potential issue inside the
 Windows' runcmd that needs fixing).

 On Fri, 30 Mar 2007, Henrik Bengtsson wrote:

  Hi,
 
  using too long pathnames for bitmap() crash R on WinXP.  I've verified
  that this is the case with R version 2.4.1 Patched (2007-03-25 r40958)
  and R version 2.5.0 alpha (2007-03-30 r40957). I cannot reproduce it
  on Linux.
 
  REPRODUCIBLE EXAMPLE:
 
  % Rterm --vanilla
 
  # Tell R where Ghostscript is
  gsexe - C:/gs/gs8.54/bin/gswin32c.exe;
  gsexe - C:/Program Files/gs/gs8.56/bin/gswin32c.exe;
  gsexe - shortPathName(gsexe);
  Sys.putenv(R_GSCMD=gsexe);
 
  # Total length of pathname (R crashes when it is too long)
  n - 130;
 
  # Output path
  path - tempdir();
 
  # Filename
  name - paste(rep(a, n-5-nchar(path)), collapse=);
  filename - paste(name, png, sep=.);
 
  # Full pathname
  pathname - file.path(path, filename);
  print(pathname);
  stopifnot(nchar(pathname) == n);
 
  bitmap(pathname);
  plot(1);
  dev.off();
 
  R crash with dev.off(), but the PNG file is still created.
 
 
  # MORE DETAILED EXAMPLE:
 
  n - 130;
  path - tempdir();
  name - paste(rep(a, n-5-nchar(path)), collapse=);
  filename - paste(name, png, sep=.);
  pathname - file.path(path, filename);
  print(pathname);
 
  # Tell R where Ghostscript is
  gsexe - C:/gs/gs8.54/bin/gswin32c.exe;
  gsexe - C:/Program Files/gs/gs8.56/bin/gswin32c.exe;
  gsexe - shortPathName(gsexe);
 
  cmd - paste(gsexe,  -dNOPAUSE -dBATCH -q -sDEVICE=png256 -r72
  -g432x432 -sOutputFile=, pathname, sep=);
  print(cmd);
  print(nchar(cmd));
 
  tmp - tempfile();
  postscript(file=tmp, width=6, height=6, pointsize=9, paper=special,
  horizontal=FALSE, print.it=TRUE, command=cmd);
  plot(1);
  dev.off();
 
  It seems to have to do with the length of 'cmd' (since the possible
  pathname length varies with the length of 'gsexe' used).
 
  Any ideas?
 
  /Henrik
 
  __
  R-devel@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-devel
 

 --
 Brian D. Ripley,  [EMAIL PROTECTED]
 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


[Rd] Matrix package: compilation error

2007-03-31 Thread Rainer Hurling
Trying to compile the package Matrix_0.9975-11.tar.gz with newest 
R-2.5.0 alpha (2007-03-31 r40986) on FreeBSD 7.0-CURRENT (i386) I get 
the following error:

-
R CMD INSTALL Matrix_0.9975-11.tar.gz
* Installing to library '/usr/local/lib/R/library'
* Installing *source* package 'Matrix' ...
** libs
** arch -
Makefile, line 10: Missing dependency operator
Makefile, line 12: Need an operator
Makefile, line 14: Need an operator
make: fatal errors encountered -- cannot continue
ERROR: compilation failed for package 'Matrix'
** Removing '/usr/local/lib/R/library/Matrix'
-


Under FreeBSD I have installed the LAPACK package (3.0.2) with library 
at location

/usr/local/lib/liblapack.so.4

Is it possible that the Makefile of package Matrix fails because of that?

Any help is appreciated,
Rainer Hurling

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


[Rd] Problem with S4 inheritance: unexpected re-initialization?

2007-03-31 Thread cstrato

Dear all,

To explain my problem I am attaching a demonstration package myclasspkg:
I have the following two S4 classes with similar inheritance:
  SubSubClassA - SubClassB - BaseClass
  SubSubClassB - SubClassB - BaseClass

In R I am calling the following functions:
 library(myclasspkg)
 subA - 
new(SubClassA,filename=OutSubA,filedir=/Volumes/CoreData/CRAN/Workspaces/rclasspkg,mytitle=TitleSubA)
 subsubA - 
new(SubSubClassA,filename=MyFileName,filedir=/Volumes/CoreData/CRAN/Workspaces/rclasspkg,subA=subA)
 subsubB - 
new(SubSubClassB,filename=MyFileNameB,filedir=/Volumes/CoreData/CRAN/Workspaces/rclasspkg,subA=subA)


Creating subsubA works fine and gives the correct result:
 subsubA - 
new(SubSubClassA,filename=MyFileName,filedir=/Volumes/CoreData/CRAN/Workspaces/rclasspkg,subA=subA)

[1] --initialize:SubSubClassA--
[1] SubSubClassA:init:class(.Object) =  SubSubClassA
[1] --initialize:SubClassB--
[1] SubClassB:init:class(.Object) =  SubSubClassA
[1] --initialize:BaseClass--
[1] BaseClass:init:class(.Object) =  SubSubClassA
[1] --pathFile--
[1] BaseClass:init:dirfile =  
/Volumes/CoreData/CRAN/Workspaces/rclasspkg/MyFileName

[1] --setValidity:BaseClass--
[1] BaseClass:val:class(object) =  SubClassB
[1] BaseClass:val:dirfile =  
/Volumes/CoreData/CRAN/Workspaces/rclasspkg/MyFileName

[1] BaseClass:val:filedir =  /Volumes/CoreData/CRAN/Workspaces/rclasspkg
[1] --setValidity:SubClassB--
[1] SubClassB:val:class(object) =  SubClassB
[1] SubClassB:val:filename =  MyFileName
[1] BaseClass:val:dirfile =  
/Volumes/CoreData/CRAN/Workspaces/rclasspkg/MyFileName

[1] --setValidity:SubSubClassA--
[1] SubSubClassA:val:class(.Object) =  SubSubClassA

In contrast, when trying to create subsubB, it seems that setValidity
re-initializes SubClassB:
 subsubB - 
new(SubSubClassB,filename=MyFileNameB,filedir=/Volumes/CoreData/CRAN/Workspaces/rclasspkg,subA=subA)

[1] --initialize:SubSubClassB--
[1] SubSubClassB:init:class(.Object) =  SubSubClassB
[1] SubSubClassB:init:subsubnameB =  subsubNameB
[1] --initialize:SubClassB--
[1] SubClassB:init:class(.Object) =  SubSubClassB
[1] --initialize:BaseClass--
[1] BaseClass:init:class(.Object) =  SubSubClassB
[1] --pathFile--
[1] BaseClass:init:dirfile =  
/Volumes/CoreData/CRAN/Workspaces/rclasspkg/MyFileNameB

[1] --setValidity:BaseClass--
[1] --initialize:SubClassB--
[1] SubClassB:init:class(.Object) =  SubClassB
[1] --initialize:BaseClass--
[1] BaseClass:init:class(.Object) =  SubClassB
[1] --pathFile--
Error in if (dirname(filename) != .) { :
   argument is of length zero

Can someone tell me why the first case works fine, but the second case not?
Probably, I am making some mistake, but since two weeks I am unable to 
find it.

Thank you in advance.

P.S.: I am running R-2.5.0 on Intel-Mac OS 10.4.8.

Best regards
Christian
_._._._._._._._._._._._._._._._
C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a
V.i.e.n.n.a   A.u.s.t.r.i.a
_._._._._._._._._._._._._._._._



myclasspkg_0.1.1.tar.gz
Description: GNU Zip compressed data
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Matrix package: compilation error

2007-03-31 Thread Prof Brian Ripley
This is because of the GNUism in Matrix/src/Makefile

## get rid of this, once we have 'Depends: R (= 2.5.0)':
ifeq (, $(findstring -lRlapack, $(LAPACK_LIBS)))
SOURCES_LAPACK =
else
SOURCES_LAPACK = zpotf2.f zpotrf.f zlacgv.f
endif

I guess you know what you need to do to fix it for BSD make?

On Sat, 31 Mar 2007, Rainer Hurling wrote:

 Trying to compile the package Matrix_0.9975-11.tar.gz with newest
 R-2.5.0 alpha (2007-03-31 r40986) on FreeBSD 7.0-CURRENT (i386) I get
 the following error:

 -
 R CMD INSTALL Matrix_0.9975-11.tar.gz
 * Installing to library '/usr/local/lib/R/library'
 * Installing *source* package 'Matrix' ...
 ** libs
 ** arch -
 Makefile, line 10: Missing dependency operator
 Makefile, line 12: Need an operator
 Makefile, line 14: Need an operator
 make: fatal errors encountered -- cannot continue
 ERROR: compilation failed for package 'Matrix'
 ** Removing '/usr/local/lib/R/library/Matrix'
 -


 Under FreeBSD I have installed the LAPACK package (3.0.2) with library
 at location

 /usr/local/lib/liblapack.so.4

 Is it possible that the Makefile of package Matrix fails because of that?

Not used unless you asked for it during R's configure.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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] Matrix package: compilation error

2007-03-31 Thread Martin Maechler
 Rainer == Rainer Hurling [EMAIL PROTECTED]
 on Sat, 31 Mar 2007 19:03:44 +0200 writes:

Rainer Trying to compile the package
Rainer Matrix_0.9975-11.tar.gz 
Rainer with newest R-2.5.0 alpha
Rainer (2007-03-31 r40986) on FreeBSD 7.0-CURRENT (i386) 

does FreeBSD use a make that is 'GNU make' compatible?
Matrix/DESCRIPTION has  a line which says
--
SystemRequirements: GNU make
--

Regards,
Martin Maechler, ETH Zurich

Rainer I get the following error:


Rainer -
Rainer R CMD INSTALL Matrix_0.9975-11.tar.gz
Rainer * Installing to library '/usr/local/lib/R/library'
Rainer * Installing *source* package 'Matrix' ...
Rainer ** libs
Rainer ** arch -
Rainer Makefile, line 10: Missing dependency operator
Rainer Makefile, line 12: Need an operator
Rainer Makefile, line 14: Need an operator
Rainer make: fatal errors encountered -- cannot continue
Rainer ERROR: compilation failed for package 'Matrix'
Rainer ** Removing '/usr/local/lib/R/library/Matrix'
Rainer -


Rainer Under FreeBSD I have installed the LAPACK package (3.0.2) with 
library 
Rainer at location

Rainer /usr/local/lib/liblapack.so.4

Rainer Is it possible that the Makefile of package Matrix fails because of 
that?

Rainer Any help is appreciated,
Rainer Rainer Hurling

Rainer __
Rainer R-devel@r-project.org mailing list
Rainer 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] Matrix package: compilation error

2007-03-31 Thread Rainer Hurling
Thanks, Brian and Martin,

I think you are both right, Matrix tries to use BSD make (/usr/bin/make) 
on FreeBSD instead of GNU make (/usr/local/bin/gmake).

Sorry, but I don't know how to persuade the configure script to use 
gmake :-(

Rainer


Prof Brian Ripley schrieb:
 This is because of the GNUism in Matrix/src/Makefile
 
 ## get rid of this, once we have 'Depends: R (= 2.5.0)':
 ifeq (, $(findstring -lRlapack, $(LAPACK_LIBS)))
 SOURCES_LAPACK =
 else
 SOURCES_LAPACK = zpotf2.f zpotrf.f zlacgv.f
 endif
 
 I guess you know what you need to do to fix it for BSD make?
 
 On Sat, 31 Mar 2007, Rainer Hurling wrote:
 
 Trying to compile the package Matrix_0.9975-11.tar.gz with newest
 R-2.5.0 alpha (2007-03-31 r40986) on FreeBSD 7.0-CURRENT (i386) I get
 the following error:

 -
 R CMD INSTALL Matrix_0.9975-11.tar.gz
 * Installing to library '/usr/local/lib/R/library'
 * Installing *source* package 'Matrix' ...
 ** libs
 ** arch -
 Makefile, line 10: Missing dependency operator
 Makefile, line 12: Need an operator
 Makefile, line 14: Need an operator
 make: fatal errors encountered -- cannot continue
 ERROR: compilation failed for package 'Matrix'
 ** Removing '/usr/local/lib/R/library/Matrix'
 -


 Under FreeBSD I have installed the LAPACK package (3.0.2) with library
 at location

 /usr/local/lib/liblapack.so.4

 Is it possible that the Makefile of package Matrix fails because of that?
 
 Not used unless you asked for it during R's configure.


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


Re: [Rd] Matrix package: compilation error

2007-03-31 Thread Andrew Robinson
Hi Rainer,

check the following post for an alternative solution:

http://tolstoy.newcastle.edu.au/R/help/06/01/18908.html

if you would like more detailed instructions, let me know.

Andrew


On Sat, Mar 31, 2007 at 10:10:45PM +0200, Rainer Hurling wrote:
 Thanks, Brian and Martin,
 
 I think you are both right, Matrix tries to use BSD make (/usr/bin/make) 
 on FreeBSD instead of GNU make (/usr/local/bin/gmake).
 
 Sorry, but I don't know how to persuade the configure script to use 
 gmake :-(
 
 Rainer
 
 
 Prof Brian Ripley schrieb:
  This is because of the GNUism in Matrix/src/Makefile
  
  ## get rid of this, once we have 'Depends: R (= 2.5.0)':
  ifeq (, $(findstring -lRlapack, $(LAPACK_LIBS)))
  SOURCES_LAPACK =
  else
  SOURCES_LAPACK = zpotf2.f zpotrf.f zlacgv.f
  endif
  
  I guess you know what you need to do to fix it for BSD make?
  
  On Sat, 31 Mar 2007, Rainer Hurling wrote:
  
  Trying to compile the package Matrix_0.9975-11.tar.gz with newest
  R-2.5.0 alpha (2007-03-31 r40986) on FreeBSD 7.0-CURRENT (i386) I get
  the following error:
 
  -
  R CMD INSTALL Matrix_0.9975-11.tar.gz
  * Installing to library '/usr/local/lib/R/library'
  * Installing *source* package 'Matrix' ...
  ** libs
  ** arch -
  Makefile, line 10: Missing dependency operator
  Makefile, line 12: Need an operator
  Makefile, line 14: Need an operator
  make: fatal errors encountered -- cannot continue
  ERROR: compilation failed for package 'Matrix'
  ** Removing '/usr/local/lib/R/library/Matrix'
  -
 
 
  Under FreeBSD I have installed the LAPACK package (3.0.2) with library
  at location
 
  /usr/local/lib/liblapack.so.4
 
  Is it possible that the Makefile of package Matrix fails because of that?
  
  Not used unless you asked for it during R's configure.
 
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Andrew Robinson  
Department of Mathematics and StatisticsTel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599
http://www.ms.unimelb.edu.au/~andrewpr
http://blogs.mbs.edu/fishing-in-the-bay/

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


[Rd] Probem with argument append in Rprof

2007-03-31 Thread Romain Francois
Hello,

Appending information to the profiler's output seems to generate
problems. Here is a small example of code :

code r
require(boot)
Rprof( memory.profiling = TRUE)
Rprof(NULL)
for(i in 1:2){
  Rprof( memory.profiling = TRUE, append = TRUE)
  example(boot)
  Rprof(NULL)
}
/code

The problem is that the file Rprof.out contains more than once the
header information:

$ grep sample.interval= Rprof.out
memory profiling: sample.interval=2
memory profiling: sample.interval=2
memory profiling: sample.interval=2

and `summaryRprof` or `R CMD Rprof` are not dealing with it

 idx - grep( sample, rownames( smp - summaryRprof()[[1]] ) );
smp[idx, ]
  self.time self.pct total.time total.pct
sample.interval=2 00   0.04   0.1

`sample.interval=2` is incorrectly considered as a function.


This is not too much of a big deal, but then if I ask for memory
profiling information as well, I get nothing:

 summaryRprof( mem = stats)
Error in tapply(1:1L, list(index = c(sample.interval=2:profiling:,  :
arguments must have same length
 summaryRprof( mem = tseries)
Error in data.frame(..., check.names = FALSE) :
arguments imply differing number of rows: 1, 1490
 summaryRprof( mem = both)
Error in apply(sapply(strsplit(memstuff, :), as.numeric), 1, diff) :
dim(X) must have a positive length

$ R CMD Rprof Rprof.out

Each sample represents  seconds.
Total run time: 0 seconds.

Total seconds: time spent in function and callees.
Self seconds: time spent in function alone.

   %   total   %   self
 totalseconds selfsecondsname
Illegal division by zero at /usr/local/lib/R/bin/Rprof line 91,  line
1491.
 
A quick fix could be to ignore all the lines containing sample.interval=
except the first one, but then if someone wants to actually change the
interval argument in Rprof, it would not be correct. I attach a patch
against R-devel/src/library/utils/R/summRprof.R to do that anyway, but I
will look at a better solution.

I am not fluent enough in Perl to do the same in the Rprof script, it
looks like it does not handle the memory profiling information anyway. I
am about to learn Perl, so I guess it could be a useful way to do it. I
also attach a patch against R-devel/src/scripts/Rprof that would at
least get rid of the memory profiling information (if any). This is not
as good as dealing with it, but ... this is the first time I ever touch
a Perl script.


Cheers,

Romain



 version
  
_  
platform  
i686-pc-linux-gnu  
arch  
i686   
os
linux-gnu  
system i686,
linux-gnu
status Under development
(unstable)   
major 
2  
minor  6.0  
year  
2007   
month 
03 
day   
30 
svn rev   
40983  
language  
R  
version.string R version 2.6.0 Under development (unstable) (2007-03-30
r40983)

-- 
Mango Solutions
data analysis that delivers

Tel:  +44(0) 1249 467 467
Fax:  +44(0) 1249 467 468
Mob:  +44(0) 7813 526 123

--- summRprof.R	2007-03-31 21:10:31.0 +0100
+++ /tmp/R-devel/src/library/utils/R/summRprof.R	2006-10-05 07:54:38.0 +0100
@@ -32,10 +32,8 @@
 repeat({
 
chunk-readLines(filename,n=chunksize)
-   chunk - chunk[ -grep(sample\\.interval=, chunk) ] 
if (length(chunk)==0)
break
-   
if (memory.profiling){
memprefix-attr(regexpr(:[0-9]+:[0-9]+:[0-9]+:[0-9]+:,chunk),match.length)
if (memory==both){
@@ -121,7 +119,6 @@
 repeat({
 
chunk-readLines(filename,n=chunksize)
-   chunk - chunk[ -grep(sample\\.interval=, chunk) ] 
if (length(chunk)==0)
break
memprefix-attr(regexpr(:[0-9]+:[0-9]+:[0-9]+:[0-9]+:,chunk),
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Matrix package: compilation error

2007-03-31 Thread Rainer Hurling
Thank you Andrew,

'setenv MAKE gmake' did it.

Now I can use latest spdep package :-)

Rainer


Andrew Robinson schrieb:
 Hi Rainer,
 
 check the following post for an alternative solution:
 
 http://tolstoy.newcastle.edu.au/R/help/06/01/18908.html
 
 if you would like more detailed instructions, let me know.
 
 Andrew
 
 
 On Sat, Mar 31, 2007 at 10:10:45PM +0200, Rainer Hurling wrote:
 Thanks, Brian and Martin,

 I think you are both right, Matrix tries to use BSD make (/usr/bin/make) 
 on FreeBSD instead of GNU make (/usr/local/bin/gmake).

 Sorry, but I don't know how to persuade the configure script to use 
 gmake :-(

 Rainer


 Prof Brian Ripley schrieb:
 This is because of the GNUism in Matrix/src/Makefile

 ## get rid of this, once we have 'Depends: R (= 2.5.0)':
 ifeq (, $(findstring -lRlapack, $(LAPACK_LIBS)))
 SOURCES_LAPACK =
 else
 SOURCES_LAPACK = zpotf2.f zpotrf.f zlacgv.f
 endif

 I guess you know what you need to do to fix it for BSD make?

 On Sat, 31 Mar 2007, Rainer Hurling wrote:

 Trying to compile the package Matrix_0.9975-11.tar.gz with newest
 R-2.5.0 alpha (2007-03-31 r40986) on FreeBSD 7.0-CURRENT (i386) I get
 the following error:

 -
 R CMD INSTALL Matrix_0.9975-11.tar.gz
 * Installing to library '/usr/local/lib/R/library'
 * Installing *source* package 'Matrix' ...
 ** libs
 ** arch -
 Makefile, line 10: Missing dependency operator
 Makefile, line 12: Need an operator
 Makefile, line 14: Need an operator
 make: fatal errors encountered -- cannot continue
 ERROR: compilation failed for package 'Matrix'
 ** Removing '/usr/local/lib/R/library/Matrix'
 -


 Under FreeBSD I have installed the LAPACK package (3.0.2) with library
 at location

 /usr/local/lib/liblapack.so.4

 Is it possible that the Makefile of package Matrix fails because of that?
 Not used unless you asked for it during R's configure.

 __
 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