Re: [Rd] R with multiple processors

2010-08-31 Thread Allan Engelhardt
Maybe you can use the same approach as the pnmath library which replaces 
many of the math functions with pthreads enabled ones when it is 
loaded?  That way people have a choice, and those who like to do things 
like doMC() and therefore want to keep the core R single-threaded can 
still do so.


Allan

On 30/08/10 17:17, Michel Boaventura wrote:

Hello,

I was taking a look at R code, and there is some places that should be
easily parallelized, as the dist() function, for example.

Is there an interest on do such thing on R? I would like to start making
patches to parallelize, but how comfortable with this are the main
developers team on R?

Best regards,

Michel

__
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 with multiple processors

2010-08-31 Thread luke

We are working on extending the approach in pnmath to other functions.
Hopefully this will make it int othe R distribution in some form
within the next couple of releases.

luke

On Mon, 30 Aug 2010, Michel Boaventura wrote:


Hello,

I was taking a look at R code, and there is some places that should be
easily parallelized, as the dist() function, for example.

Is there an interest on do such thing on R? I would like to start making
patches to parallelize, but how comfortable with this are the main
developers team on R?

Best regards,

Michel

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



--
Luke Tierney
Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa  Phone: 319-335-3386
Department of Statistics andFax:   319-335-3017
   Actuarial Science
241 Schaeffer Hall  email:  l...@stat.uiowa.edu
Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu

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


Re: [Rd] Including C Code for Tcl and Tk in an R package

2010-08-31 Thread Adrian Waddell
On 08/30/2010 03:01 AM, Prof Brian Ripley wrote:
> On Mon, 30 Aug 2010, Adrian Waddell wrote:
> 
>> Dear R Community,
>>
>> I adapted the C-Code found at (http://wiki.tcl.tk/25685) implementing
>> fast image resizing for Tk images for my R package.
>>
>> The C Code differs for tcl/tk version 8.4 and 8.5. I have the working
>> code for both versions.
>>
>> How do I integrate this C-Code into my package so that R CMD INSTALL
>> takes care of compiling the function correct for each OS and tcl
>> version? (such that I can submit the package to CRAN).
>>
>> Once the two files would be compiled I could load the correct function
> 
> You can't do that: very few systems will have both Tcl 8.4 and 8.5
> libraries installed.  So you need to use the package's configure script
> to detect the Tcl/Tk version and also what libraries to compile against.
> 
> I'm not sure I would try to support Tcl 8.4: 8.5 has been out for a long
> time now and you could simply make it a package SystemRequirement.  We
> are only support 8.4 in R because we have existing code to do so that
> has not yet been removed.
> 

Thank you very much for your input. Does anybody know by any chance a
package which would provide an example of such a configure script?

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


Re: [Rd] RCMD CHECK and non-methods

2010-08-31 Thread Mark.Bravington
Thanks for those (very different!) responses. I was about to respond to 
Martin's question about doco amendments, when I saw Simon's reply. 

Case 1: If Martin completely prevails, then I guess the appropriate amendment 
to the documentation would be in R-extensions, section 1.3.1 "Checking 
packages", item 10:

  <<... In addition, it is checked whether methods have all arguments of the 
corresponding generic,...>>

would become

  <<... In addition, it is checked whether potential methods[1] have all 
arguments of the corresponding generic,...>>

where [1] refers to a footnote:

  <<"Potential methods" here includes any function whose name starts with a 
known S3 generic followed by a period, e.g. 'subset.blahblah.blah'. This 
applies regardless of whether the function is formally registered as an S3 
method (see 1.6.2), and even if the function is not intended to be a method at 
all. It is bad practice to give method-like names to non-methods.>>
  
For absolutely strict super-nanny-level consistency, maybe there ought also to 
be a change somewhere in the QC/codoc code, to detect "methods" that haven't 
been registered with 'S3method', and/or have non-generic-style USAGE sections, 
regardless of whether they happen to have arguments compatible with whatever 
generic R thinks they belong to. At present, there is a difference in what 
'tools::checkDocStyle' and 'tools::checkS3methods' regard as a method. However, 
enforcing this extra check does strike me as a bit draconian, and would 
certainly break back-compatibility (in other bits of my code, for a start). 
You'd have to ask whether it's worth the effort. In my example, I don't think 
it's worth worrying that anyone is ever going to define an S3 class called 
'with.warning' and decide to call 'subset' on it.

Case 2: If Simon completely prevails, then there should be changes in 
'tools::checkS3methods' to exempt "documented non-methods". I think the 
appropriate definition of "documented non-methods" would be functions with a 
USAGE section that includes the full function name rather than the generic. 
That's supposed to cover packages with and without NAMESPACEs.

WRTO Simon's comment: I feel the same negative way about camel-case for the 
same reasons, and would want a much stronger reason to change the naming 
convention I've been using for 15 years; it's hard enough to remember what name 
I gave to a function, letAlone how_I_decided to.spell ItThatWeek.

However, I really really hope that S3 *doesn't* get replaced by S4! S3 is very 
easy to use, and for me it "just works" 99% of the time. Just occasionally it 
doesn't, but for me at least "the [S4] cure is worse than the [S3] disease". 
I'll keep an open mind about R5 ;)

Mark Bravington
CSIRO CMIS
Marine Lab
Hobart
Australia

From: Simon Urbanek [simon.urba...@r-project.org]
Sent: 27 August 2010 02:46
To: Martin Maechler
Cc: Bravington, Mark (CMIS, Hobart); r-devel@r-project.org
Subject: Re: [Rd] RCMD CHECK and non-methods

On Aug 26, 2010, at 11:36 AM, Martin Maechler wrote:

>>  
>>on Wed, 25 Aug 2010 14:06:07 +1000 writes:
>
>> I recently moved a function 'subset.with.warning' into the 'mvbutils' 
>> package (a version not yet on CRAN). When I tried RCMD CHECK, I got this 
>> warning:
>> * checking S3 generic/method consistency ... WARNING
>> subset:
>> function(x, ...)
>> subset.with.warning:
>> function(x, cond, mess.head, mess.cond, row.info, sub)
>
>> See section 'Generic functions and methods' of the 'Writing R Extensions'
>> manual.
>
>> I know that S3 method arguments need to be compatible with arguments of the 
>> generic. However, 'subset.with.warning' is deliberately not a registered S3 
>> method,
>
> I think that's your real trouble ... and then your users' if you
> really insist.
> Short answer:  "Don't do that!"
>
> There have been a few exceptions of "100 years old" R functions
> which validated this rule,
> the most notable probably  t() and t.test(),
> and we (R core) have explicitly listed them in the code base
> as "yes, looks like a method for an S3 generic, but not it ain't!",
> but have basically "forbidden" to commit more such crimes.
> {Also, if you are interested: I think both  t() and t.test()
> pre-dated S3}
>

However, one would hope that S3 will be replaced by S4 (or R5? ;)) eventually 
so requiring such an arcane rule seems little strong. Personally, I prefer the 
use of . to that of camelCase [I find it more readable and faster to type] and 
thus I'm with Mark on this one. IMHO it is perfectly legal and clean to declare 
a symbol as a function and not an S3 method.

Cheers,
Simon



>
>> and its USAGE section doesn't include a \method{generic}{class} statement. I 
>> couldn't see anything in "R Extensions" that says "don't do this", so I'm 
>> wondering:
>
> Yes, we should add a such "don't do this" somewhere.
>
> Can you propose a good place to put it in there?
>
>> - should this really be a NOTE not a WARNING 

Re: [Rd] R with multiple processors

2010-08-31 Thread Michel Boaventura
Em 31-08-2010 09:24, l...@stat.uiowa.edu escreveu:
> We are working on extending the approach in pnmath to other functions.
> Hopefully this will make it int othe R distribution in some form
> within the next couple of releases.

That is very nice. Is there a place where I can see how the work is
going, and try to help it out?

Regards

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