Re: [Rd] bug, feature of mistery?

2005-05-10 Thread Seth Falcon
Giuseppe Ragusa <[EMAIL PROTECTED]> writes:

> I have two machines a linux_amd64_x86 (gentoo_amd64) and a
> linux_x86. 

You might want to try running valgrind on your code on the 32bit
machine.  This may turn up a silent coding error that is manifesting
on the 64bit platform.

I think there is a new R CMD check option to do valgrind.

+ seth

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


[Rd] Feature request: report the url if 404 error occurs

2005-04-25 Thread Seth Falcon
Currently, the connection code does not include the URL in the warning
message when a 404 response is received:

myUrl = "http://www.r-project.org/ABadPage.html";
con = url(myUrl)
readLines(con)

  Error in readLines(con) : cannot open the connection
  In addition: Warning message:
  cannot open: HTTP status was '404 Not Found' 

Would it be possible (and desirable) to include the URL in the warning
message?  Here's an example:

Error in readLines(con) : cannot open the connection
In addition: Warning message:
cannot open 'http://www.r-project.org/ABadPage.html': HTTP status was '404 Not 
Found' 


+ seth

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


Re: [Rd] Objects in R

2005-04-24 Thread Seth Falcon
Duncan Murdoch <[EMAIL PROTECTED]> writes:
> What S4 is missing is "encapsulation". Wikipedia's article on 
> object-oriented programming gives a good definition:
>
> "Encapsulation - Ensures that users of an object cannot change the 
> internal state of the object in unexpected ways; only the object's own 
> internal methods are allowed to access its state. Each object exposes an 
> interface that specifies how other objects may interact with it."
>
> Neither of these properties holds in S4.

I don't like the definition of encapsulation in the Wikipedia.  If
nothing else, I think the second part about objects exposing an
interface specifying how to interact with them should come first ---
and S4 provides that.

In my experience, the ability to create "obvious" interfaces to
classes is the important part of encapsulation.  Python's object
system, for example, does not (easily) provide protections against
abuse, but other than some initial misgivings, I've not missed it.

+ seth

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


Re: [Rd] Overloading methods in R

2005-04-20 Thread Seth Falcon
"Ali -" <[EMAIL PROTECTED]> writes:
> On the other hand, I caouldn't find a decent OO package which is
> based on S4 AND comes with the official release of R.

The OO system that comes with R and is based on S4 *is* S4.  The
challenge is that it is a different way of doing OO as compared to
Java.  But for most uses, it works just fine once you get used to
"spelling" things differently.

+ seth

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


Re: [Rd] S4 methods semantics questions

2005-03-25 Thread Seth Falcon
John Chambers <[EMAIL PROTECTED]> writes:

> Well, the intent is that defaults are indeed taken from the method, if
> there is a default there, otherwise from the generic.  It looks as if
> there is a bug in the case that the generic has NO default for that
> argument (unless, of course, it's a subtle feature, but not that I can
> think of at the moment).
>
> Your example works as intended if there is a default expression for y
> in the generic:
>
> R> setGeneric("foo",function(x,y=stop("Need y")) standardGeneric("foo"))
> [1] "foo"
> R> setMethod("foo","numeric",function(x,y=2) x+y)
> [1] "foo"
> R> foo(1)
> [1] 3

FWIW, I've encountered the same error that the OP described.  I
certainly don't know if it is a bug, but I can say that I expected it
to work based on the documentation of setMethod.  

I ended up with a different workaround: if you don't need to do
dispatching on the default arguments, you can set

setGeneric("foo", function(x, ...) standardGeneric("foo"))

and then methods with defaults defined in their function do the
expected thing.

Best,

+ seth

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


Re: [Rd] trouble building r-devel

2005-03-21 Thread Seth Falcon
<[EMAIL PROTECTED]> writes:
> cp unicode/iconv.dll ../../modules/
> cp: cannot stat `unicode/iconv.dll': No such file or directory
> make[2]: *** [rmodules] Error 1
> make[1]: *** [rbuild] Error 2
> make: *** [all] Error 2

See the section Unicode support here:
http://www.murdoch-sutherland.com/Rtools/

Basically, you just need to download and then copy the iconv.dll to
the right spot and you should be on your way.

+ seth

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


[Rd] Buglet in install.packages warning message

2005-03-20 Thread Seth Falcon
I've been experimenting with install.packages and it's new ability to
track down dependencies from a list of repositories and encountered
this:

install.packages(c("foo", "bar"), repos="http://cran.r-project.org";, 
 dependencies=c("Depends", "Suggests"))

dependencies 'foo' are not availabledependencies 'bar' are not available
   

With the following change (see below) I get what I suspect is the
intended warning message:

   dependencies 'foo', 'bar' are not available


+ seth


Index: packages2.R
===
--- packages2.R (revision 33678)
+++ packages2.R (working copy)
@@ -125,7 +125,7 @@
 cat(sprintf(ngettext(sum(miss),
  "dependency %s is not available",
  "dependencies %s are not available"),
-paste(sQuote(p1[miss]), sep=", ")), "\n\n", sep ="")
+paste(sQuote(p1[miss]), collapse=", ")), "\n\n", sep ="")
 flush.console()
 }
 p1 <- p1[!miss]

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


Re: [Rd] Trouble debugging with gdb, R on Windows

2005-03-18 Thread Seth Falcon
Paul Roebuck <[EMAIL PROTECTED]> writes:
> Not a Windows developer so this may be off but did you try
> loading the shared library prior to setting your breakpoint?
>
> (gdb) break WinMain
> (gdb) run
> (gdb) info share

Yes, in the transcript of gdb included in my post I did the first two
lines of the above.  Just tried the 'info share' and I see R.dll is
loaded, but I still get the same error when trying to set another
breakpoint.

Thanks,

+ seth

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


[Rd] Trouble debugging with gdb, R on Windows

2005-03-18 Thread Seth Falcon
I'm trying to follow the example in the R for Windows FAQ on running
gdb and am getting stuck because gdb tells me "Cannot access memory at
address ...".

Here's what my gdb session looks like (This one from a cygwin shell,
but same results from plain Windows CMD shell):

$ cd R-devel/src/gnuwin32
$ gdb ../../bin/Rgui.exe
GNU gdb 5.2.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-mingw32"...
(gdb) break WinMain
Breakpoint 1 at 0x401296: file ../graphapp/graphappmain.c, line 59.
(gdb) run
Starting program: y:\falcon\src\R-devel\src\gnuwin32/../../bin/Rgui.exe

Breakpoint 1, WinMain (Instance=0x40, PrevInstance=0x0,
CmdLine=0x261f26 "", CmdShow=10) at ../graphapp/graphappmain.c:59
59  startgraphapp(Instance, PrevInstance, CmdShow);
(gdb) break R_ReadConsole
Cannot access memory at address 0x23e17
(gdb) info symbol 0x23e17
R_ReadConsole in section .text
(gdb)

Any suggestions?  Attempting to set other break points (do_BLAH) gives
the same result.

I compiled with 'make DEBUG=T' per the instructions on Duncan
Murdoch's Building R for Windows page.  I also tried compiling after
modifying the makefiles to remove -02 optimization (see patch below
for what I did).  

Thanks,

+ seth







Index: src/extra/intl/Makefile.win
===
--- src/extra/intl/Makefile.win (revision 33477)
+++ src/extra/intl/Makefile.win (working copy)
@@ -18,6 +18,10 @@
 endif
 
 CFLAGS = -O2 $(DEFS) -I. -I../../include
+ifdef DEBUG 
+  CFLAGS = $(DEFS) -I. -I../../include
+endif
+
 dcigettext-CFLAGS=-DLOCALEDIR=\"\"
 
 SOURCES = \
Index: src/gnuwin32/Makefile
===
--- src/gnuwin32/Makefile   (revision 33477)
+++ src/gnuwin32/Makefile   (working copy)
@@ -33,8 +33,8 @@
 ## use FOPTFLAGS where complex*16 is used.
 FOPTFLAGS=-O2 -Wall
 ifdef DEBUG
- OPTFLAGS+=-g
- FOPTFLAGS+=-g
+ OPTFLAGS=-g -Wall -pedantic
+ FOPTFLAGS=-g -Wall
  DLLFLAGS=
 else
  DLLFLAGS=-s

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


Re: [Rd] How to use Rmpi?

2005-03-10 Thread Seth Falcon
Hi Alessandro,
"Alessandro Balboni" <[EMAIL PROTECTED]> writes:
> I need to rewrite a software in R, that runs on a cluster.

If you haven't already, take a look at the snow package on CRAN.  It
provides an easier to use wrapper around either Rmpi or Rpvm.  The
included documentation has some examples that should get you going.

+ seth

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


Re: [Rd] Error on Windows installing package to non-default library

2005-03-02 Thread Seth Falcon
On Mar 2, 2005, at 8:54 AM, Prof Brian Ripley wrote:
You can't please everyone all the time, and in this case you cannot 
just make the substitution as

1) some parts of Windows demand \
2) \ is a trail byte in some Japanese characters.
I had a feeling it wouldn't be so simple, but wanted to bring it up in 
case...

Why don't you just ensure that you don't use such paths for 
.libPaths()?
Will do.
Thanks,
+ seth
__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Error on Windows installing package to non-default library

2005-03-02 Thread Seth Falcon
Hi all,
I'm seeing an error on Windows when I try to install a package to a 
package library path that starts with a digit.  I can reproduce the 
error as follows using R-devel from Feb 24 on Windows advanced server:

badLib = "c:\\badExample\\2\\foo"
dir.create(badLib, recursive=TRUE)
z = .libPaths()
z = .libPaths(c(badLib, z))
z
[1] "c:\\badExample\\2\\foo" "C:/falcon/sw/rw2010dev/library"
pkg = "c:\\falcon\\abind_1.1-0.zip"
install.packages(pkg, repos=NULL, lib=badLib)
package 'abind' successfully unpacked and MD5 sums checked
updating HTML package descriptions
Error in gsub("^URL: ../../../library", lib0, readLines(cfile)) :
invalid backreference 2 in regular expression
After looking at src/library/utils/R/windows/linkhtml.R, it seems the 
error is that the "\\2" part of the path is interpreted by gsub as a 
back reference.

Changing "\\" to "/" in the library path fixes this issue:
> okLib = chartr("\\", "/", badLib)
> z = .libPaths(okLib)
> z
[1] "c:/badExample/2/foo""C:/falcon/sw/rw2010dev/library"
> install.packages(pkg, repos=NULL, lib=okLib)
package 'abind' successfully unpacked and MD5 sums checked
updating HTML package descriptions
So adding a call to chartr inside make.search.html would seem to be an
improvement (i.e, it looks good from here, but I haven't tested and
don't know if there are reasons why this would be a bad idea).  OTOH,
maybe this should have already happened in the call to .libPaths()?
This came up because on the Windows server I'm using, tempdir() 
contains a directory names "2" as part of the path --- and I want to be 
able to install package to temporary package libraries for testing 
purposes.

+ seth
__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Regex Crashing R (perl = TRUE) (PR#7564)

2005-01-26 Thread Seth Falcon
A side response...
On Jan 25, 2005, at 1:03 PM, [EMAIL PROTECTED] wrote:
As a side note, is there a good way of incorporating an uncompiled perl
script into an R package to be invoked from a system call? Putting it 
in
the /src directory seems like the obvious place, but I can't convince R
to copy over the script uncompiled upon installation.
That's what the inst/ directory of a package is for, I believe.  Look 
for details in the Writing R Extensions manual.  You might also want to 
look at system.file() which can help you locate files in an installed 
package.

+ seth
__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel