Re: [Rd] Rmpi and OpenMPI ?

2007-03-30 Thread Dirk Eddelbuettel

On 30 March 2007 at 12:48, Ei-ji Nakama wrote:
| Prof. Nakano(ism Japan) and I wrestled in Rmpi on HP-MPI.
| Do not know a method to distinguish MPI well?
| It is an ad-hoc patch at that time as follows.

Thank you *very much* for this.  I tried an ad-hoc patch that did about half
of this (i.e. coping with configure, and not letting zzz.R play with lamboot)
which let to Rmpi at least building ... but not yet running.

I will look more closely at what needs to happen at the C/C++ level in MPI
and see if I can (eventually) put the rest together.

As for your question about distinguishing MPI implementations: Not sure yet.
Under Debian, I had to un-install the lam and mpich2 development packages as
configure would otherwise find their mpi.h first.  I'll have to see if there
is a canonical / portable identifier for MPI.

For anybody else reading along, this appears to be a great resource (and it
requires a free registration for webct): 

http://webct.ncsa.uiuc.edu:8900/public/MPI/

Regards,  Dirk

-- 
Hell, there are no rules here - we're trying to accomplish something. 
  -- Thomas A. Edison

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


[Rd] use of ... in some functions does not work (PR#9591)

2007-03-30 Thread wolfram
Consider:

x.lm <- function( ... ) lm( ... )
x.xyplot <- function( ... ) xyplot( ... )
x.dotplot <- function( ... ) dotplot( ... )

lm( dist ~ speed, data=cars, weight=speed )
x.lm( dist ~ speed, data=cars, weight=speed )

xyplot( variety ~ yield | site, groups=year, data=barley )
x.xyplot( variety ~ yield | site, groups=year, data=barley )

dotplot( variety ~ yield | site, groups=year, data=barley )
x.dotplot( variety ~ yield | site, groups=year, data=barley )

Out of the x.* functions only the x.xyplot function works.
The others results in a message like:
Error in eval(expr, envir, enclos) : ..2
used in an incorrect context, no ... to look in

Regards - Wolfram

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


[Rd] bug?

2007-03-30 Thread Hiroyuki Kawakatsu
> rep(2,0)
numeric(0)
> rep(2,0,2)
[1] 2 2
> rep(2,0,2,0)
Floating exception (core dumped)

#yes, i should not be doing this but i mistakenly did
#par(oma=rep(2,0,2,0)) when i meant c(2,0,2,0)
#
#both on
#2.4.1 Patched (2007-03-21 r40875); x86_64-unknown-freebsd6.2
#and
#2.5.0 alpha (2007-03-30 r40957); i386-pc-mingw32

-- 
--
Hiroyuki Kawakatsu
Business School
Dublin City University
Dublin 9, Ireland
Tel +353 (0)1 700 7496

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


[Rd] error in lattice formattedTicksAndLabels.Date (PR#9590)

2007-03-30 Thread jszinger
Full_Name: James Szinger
Version: 2.4.1
OS: linux and MacOS X
Submission from: (NULL) (128.165.24.206)


I'm trying to plot some data from the past 12 months and the lattice package is
not labeling the time axis correctly.  It shows only two labels instead of the
expected 12.  The base graphics get it right.  

I think the problem is the commented-out line in formattedTicksAndLabels.Date in
lattice's axis.R:
## z <- c(range, x[is.finite(x)])

The following example demonstrates the problem:

require(lattice)  #lattice_0.14-16

x <- rnorm(12)
t <- seq( as.Date("2006-04-01"),by="month", length=12)

plot(x~t)  # Has labels "May", "Jul", "Sep", "Nov", Jan", "Mar"
xyplot(x~t)# Has labels "Jan", "Mar"

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


[Rd] Replacing slot of S4 class in method of S4 class?

2007-03-30 Thread cstrato
Dear all,

Assume that I have an S4 class "MyClass" with a slot "myname", which
is initialized to:  myname="" in method("initialize"):
   myclass <- new("MyClass", myname="")

Assume that class "MyClass" has a method "mymethod":
   "mymethod.MyClass" <-
   function(object, myname=character(0), ...) {
   [EMAIL PROTECTED] <- myname;
   #or:myName(object) <- myname
   }
   setMethod("mymethod", "MyClass", mymethod.MyClass);

Furthermore, I have a replacement method:
setReplaceMethod("myName", signature(object="MyClass", value="character"),
   function(object, value) {
  [EMAIL PROTECTED] <- value;
  return(object);
   }
)

I know that it is possible to call:
   myName(myclass) <- "newname"

However, I want to replace the value of slot "myname" for object "myclass"
in method "mymethod":
   mymethod(myclass,  myname="newname")

Sorrowly, the above code in method "mymethod" does not work.

Is there a possibility to change the value of a slot in the method of a 
class?

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
_._._._._._._._._._._._._._._._

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


Re: [Rd] bug?

2007-03-30 Thread Prof Brian Ripley
Yes, it is a bug, thanks.

It needs a test for each > 0 if length.out > 0 is set. Added for 2.5.0.

On Fri, 30 Mar 2007, Hiroyuki Kawakatsu wrote:

>> rep(2,0)
> numeric(0)
>> rep(2,0,2)
> [1] 2 2
>> rep(2,0,2,0)
> Floating exception (core dumped)
>
> #yes, i should not be doing this but i mistakenly did
> #par(oma=rep(2,0,2,0)) when i meant c(2,0,2,0)
> #
> #both on
> #2.4.1 Patched (2007-03-21 r40875); x86_64-unknown-freebsd6.2
> #and
> #2.5.0 alpha (2007-03-30 r40957); i386-pc-mingw32
>
>

-- 
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] error in lattice formattedTicksAndLabels.Date (PR#9590)

2007-03-30 Thread Marcus G. Daniels
Hi Jim,
> x <- rnorm(12)
> t <- seq( as.Date("2006-04-01"),by="month", length=12)
>
> plot(x~t)  # Has labels "May", "Jul", "Sep", "Nov", Jan", "Mar"
> xyplot(x~t)# Has labels "Jan", "Mar"
How about:

plot(x~t,xaxt="n")
axis(1,at=t,labels=format.Date(t))

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


Re: [Rd] Replacing slot of S4 class in method of S4 class?

2007-03-30 Thread Simon Urbanek
Please read the posting guide and use the appropriate mailing list (R- 
help) - your question has nothing to do with the development of R.

Cheers,
Simon

PS: look closely at your code - your mymethod is a noop.


On Mar 30, 2007, at 4:45 PM, cstrato wrote:

> Dear all,
>
> Assume that I have an S4 class "MyClass" with a slot "myname", which
> is initialized to:  myname="" in method("initialize"):
>myclass <- new("MyClass", myname="")
>
> Assume that class "MyClass" has a method "mymethod":
>"mymethod.MyClass" <-
>function(object, myname=character(0), ...) {
>[EMAIL PROTECTED] <- myname;
>#or:myName(object) <- myname
>}
>setMethod("mymethod", "MyClass", mymethod.MyClass);
>
> Furthermore, I have a replacement method:
> setReplaceMethod("myName", signature(object="MyClass",  
> value="character"),
>function(object, value) {
>   [EMAIL PROTECTED] <- value;
>   return(object);
>}
> )
>
> I know that it is possible to call:
>myName(myclass) <- "newname"
>
> However, I want to replace the value of slot "myname" for object  
> "myclass"
> in method "mymethod":
>mymethod(myclass,  myname="newname")
>
> Sorrowly, the above code in method "mymethod" does not work.
>
> Is there a possibility to change the value of a slot in the method  
> of a
> class?
>
> 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
> _._._._._._._._._._._._._._._._
>
> __
> 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] Replacing slot of S4 class in method of S4 class?

2007-03-30 Thread Ross Boylan
On Fri, Mar 30, 2007 at 10:45:38PM +0200, cstrato wrote:
> Dear all,
> 
> Assume that I have an S4 class "MyClass" with a slot "myname", which
> is initialized to:  myname="" in method("initialize"):
>myclass <- new("MyClass", myname="")
> 
> Assume that class "MyClass" has a method "mymethod":
>"mymethod.MyClass" <-
>function(object, myname=character(0), ...) {
>[EMAIL PROTECTED] <- myname;
>#or:myName(object) <- myname
>}
>setMethod("mymethod", "MyClass", mymethod.MyClass);
> 
> Furthermore, I have a replacement method:
> setReplaceMethod("myName", signature(object="MyClass", value="character"),
>function(object, value) {
>   [EMAIL PROTECTED] <- value;
>   return(object);
>}
> )
> 
> I know that it is possible to call:
>myName(myclass) <- "newname"
> 
> However, I want to replace the value of slot "myname" for object "myclass"
> in method "mymethod":
>mymethod(myclass,  myname="newname")
> 
> Sorrowly, the above code in method "mymethod" does not work.
> 
> Is there a possibility to change the value of a slot in the method of a 
> class?

Yes, but to make the effect persistent (visible might be a more
accurate description) that method must return the
object being updated, and you must use the return value.  R uses call
by value semantics, so in the definition of mymethod.MyClass when you
change object you only change a local copy.  It needs to be
 "mymethod.MyClass" <-
function(object, myname=character(0), ...) {
[EMAIL PROTECTED] <- myname;
object
  }

Further, if you invoke it with
mymethod(myclass, "new name")
you will discover myclass is unchanged.  You need
myclass <- mymethod(myclass, "new name")

You might consider using the R.oo package, which probably has
semantics closer to what you're expecting.  Alternately, you could
study more about R and functional programming.

Ross Boylan

P.S. Regarding the follow up saying that this is the wrong list, the
guide to mailing lists says of R-devel
"This list is intended for questions and discussion about code
development in R. Questions likely to prompt discussion unintelligible
to non-programmers or topics that are too technical for R-help's
audience should go to R-devel,"
The question seems to fall under this description to me, though I am
not authoritative.  It is true that further study would have disclosed
what is going on.  Since the same thing tripped me up too, I thought
I'd share the answer.

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


Re: [Rd] Rmpi and OpenMPI ?

2007-03-30 Thread Ross Boylan
On Fri, Mar 30, 2007 at 03:01:19PM -0500, Dirk Eddelbuettel wrote:
> 
> On 30 March 2007 at 12:48, Ei-ji Nakama wrote:
> | Prof. Nakano(ism Japan) and I wrestled in Rmpi on HP-MPI.
> | Do not know a method to distinguish MPI well?
> | It is an ad-hoc patch at that time as follows.

There are some autoconf snippets for figuring out how to compile
various MPI versions; it's not clear to me they are much help in
figuring out which version you've got.  Perhaps they are some help:
http://autoconf-archive.cryp.to/ax_openmp.html
http://autoconf-archive.cryp.to/acx_mpi.html

Ross

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


Re: [Rd] error in lattice formattedTicksAndLabels.Date (PR#9590)

2007-03-30 Thread Deepayan Sarkar
On 3/29/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Full_Name: James Szinger
> Version: 2.4.1
> OS: linux and MacOS X
> Submission from: (NULL) (128.165.24.206)

Bugs in packages are supposed to go to package maintainers, not r-bugs.

> I'm trying to plot some data from the past 12 months and the lattice package 
> is
> not labeling the time axis correctly.  It shows only two labels instead of the
> expected 12.  The base graphics get it right.
>
> I think the problem is the commented-out line in formattedTicksAndLabels.Date 
> in
> lattice's axis.R:
> ## z <- c(range, x[is.finite(x)])

Why do you think so? This has nothing to do with it.

> The following example demonstrates the problem:
>
> require(lattice)  #lattice_0.14-16
>
> x <- rnorm(12)
> t <- seq( as.Date("2006-04-01"),by="month", length=12)
>
> plot(x~t)  # Has labels "May", "Jul", "Sep", "Nov", Jan", "Mar"
> xyplot(x~t)# Has labels "Jan", "Mar"

The problem is in the nuances of the algorithm used. You can trigger
the same behavior with base graphics by mimicking what's happening
internally in lattice:

> tt = lattice:::extend.limits(range(t))
> tt
[1] "2006-03-08" "2007-03-24"
> plot(range(x) ~ tt, xaxs = "i")

There is a fundamental difference in how base and lattice handle axis
annotation. In particular, base uses all the data to determine tick
positions, while lattice uses only the range. This is hard to change
given how lattice comes up with a common range combining different
panels. It might still be possible to get around this, but don't
expect a quick solution.

(You can of course specify tick positions explicitly using 'scales')

-Deepayan

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


Re: [Rd] Replacing slot of S4 class in method of S4 class?

2007-03-30 Thread cstrato
Dear Ross

Thank you for your explanation, now mymethod works (Simon gave me 
already a hint).

Regarding the use of this list, I am confused. Which of my former questions
regarding S4 classes belong to this list:
https://stat.ethz.ch/pipermail/r-devel/2007-March/044840.html
https://stat.ethz.ch/pipermail/r-devel/2007-March/044918.html
https://stat.ethz.ch/pipermail/r-devel/2007-March/044937.html
Since I am trying to develop a package for Bioconductor, should I use the
Bioconductor development list instead?

Best regards
Christian


Ross Boylan wrote:
> On Fri, Mar 30, 2007 at 10:45:38PM +0200, cstrato wrote:
>   
>> Dear all,
>>
>> Assume that I have an S4 class "MyClass" with a slot "myname", which
>> is initialized to:  myname="" in method("initialize"):
>>myclass <- new("MyClass", myname="")
>>
>> Assume that class "MyClass" has a method "mymethod":
>>"mymethod.MyClass" <-
>>function(object, myname=character(0), ...) {
>>[EMAIL PROTECTED] <- myname;
>>#or:myName(object) <- myname
>>}
>>setMethod("mymethod", "MyClass", mymethod.MyClass);
>>
>> Furthermore, I have a replacement method:
>> setReplaceMethod("myName", signature(object="MyClass", value="character"),
>>function(object, value) {
>>   [EMAIL PROTECTED] <- value;
>>   return(object);
>>}
>> )
>>
>> I know that it is possible to call:
>>myName(myclass) <- "newname"
>>
>> However, I want to replace the value of slot "myname" for object "myclass"
>> in method "mymethod":
>>mymethod(myclass,  myname="newname")
>>
>> Sorrowly, the above code in method "mymethod" does not work.
>>
>> Is there a possibility to change the value of a slot in the method of a 
>> class?
>> 
>
> Yes, but to make the effect persistent (visible might be a more
> accurate description) that method must return the
> object being updated, and you must use the return value.  R uses call
> by value semantics, so in the definition of mymethod.MyClass when you
> change object you only change a local copy.  It needs to be
>  "mymethod.MyClass" <-
> function(object, myname=character(0), ...) {
> [EMAIL PROTECTED] <- myname;
>   object
>   }
>
> Further, if you invoke it with
> mymethod(myclass, "new name")
> you will discover myclass is unchanged.  You need
> myclass <- mymethod(myclass, "new name")
>
> You might consider using the R.oo package, which probably has
> semantics closer to what you're expecting.  Alternately, you could
> study more about R and functional programming.
>
> Ross Boylan
>
> P.S. Regarding the follow up saying that this is the wrong list, the
> guide to mailing lists says of R-devel
> "This list is intended for questions and discussion about code
> development in R. Questions likely to prompt discussion unintelligible
> to non-programmers or topics that are too technical for R-help's
> audience should go to R-devel,"
> The question seems to fall under this description to me, though I am
> not authoritative.  It is true that further study would have disclosed
> what is going on.  Since the same thing tripped me up too, I thought
> I'd share the answer.
>
>
>

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


Re: [Rd] Rmpi and OpenMPI ?

2007-03-30 Thread Dirk Eddelbuettel

Ross,

On 30 March 2007 at 14:47, Ross Boylan wrote:
| On Fri, Mar 30, 2007 at 03:01:19PM -0500, Dirk Eddelbuettel wrote:
| > 
| > On 30 March 2007 at 12:48, Ei-ji Nakama wrote:
| > | Prof. Nakano(ism Japan) and I wrestled in Rmpi on HP-MPI.
| > | Do not know a method to distinguish MPI well?
| > | It is an ad-hoc patch at that time as follows.
| 
| There are some autoconf snippets for figuring out how to compile
| various MPI versions; it's not clear to me they are much help in
| figuring out which version you've got.  Perhaps they are some help:

Thanks, potentially very helpful.  

| http://autoconf-archive.cryp.to/ax_openmp.html

[ Nit:  OpenMP != OpenMPI ]

| http://autoconf-archive.cryp.to/acx_mpi.html

That seems more about testing C, C++ and F77/F90 for MPI. Still useful, but
not a discriminator between different MPI flavours.

But I don't mean to criticise -- this autoconf-archive looke very useful, so
thanks again.

Dirk

-- 
Hell, there are no rules here - we're trying to accomplish something. 
  -- Thomas A. Edison

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


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

2007-03-30 Thread Henrik Bengtsson
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


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

2007-03-30 Thread Prof Brian Ripley
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