Re: [Rd] tests Rin and Rout

2008-04-01 Thread cgenolin
Martin Maechler [EMAIL PROTECTED] a écrit :

 CG == Christophe Genolini [EMAIL PROTECTED]
 on Mon, 31 Mar 2008 00:31:55 +0200 writes:


 Generally I find it's good to look at examples that work.
 For examples of packages using tests, look at source
 packages on CRAN.  Run the tests on them (using R CMD
 check), and see what gets produced.

CG Do you have the name of a package that use it ? I try
CG the 10 first package, and 10 other at random, but none
CG of them use tests...

 hmm, I see 219 out 1378 CRAN packages having a 'tests'
 subdirectory, so it seems you have been a bit unlucky. ;-)

Do you imply that I say I try and I did not ?
Well, lets check that :

P_unluck_1   - 1-(219/1379)
(P_unluck_10 - P_unluck_1^10)
[1] 0.1773933

So P0.05, once can not say that I am not a liar.
Further investigation are needed :-)

 Isn't all this is explained nicely in the Writing R Extensions Manual?

NO ! There is 8 lines on it, and the structure of the Rin and Rout is 
not given. The writing R Ext. say the Test code can be in .R or in 
.Rin but I do not know what test code is suppose to be. I try simple 
things like some function with argument, but it does not works. I try 
more complicated things, I did not manage to find the right things to 
do.

It also say .Rin file containing code which in turn in .R, but there 
is also no information about the what the .Rin should be. May be it is 
obvious for some people, but not for me.

 Or are there sections we should expand ?

I do not know, if there is only few people using it, may be it is not 
worth. I guess you have so many other thinks to do...
On the other hand, if some tool are to difficult to understand, it is 
normal that people do not use them... I don't know.

I will work on package example that Pr Ripley point to me. Then when I 
will have understand the way it works, would you like me to add little 
paragraph in Writing R extention ? I mean, not an paragraph by expert 
but a paragraph by a regular medium level user for some other regular 
medium level user.

 For answering your subsequent questions, you should probably
 both look at an example package *and* read the 'Writing R
 Extensions' manual a bit more closely.

Well, I try to not disturb people for little obvious thinks. I can tell 
you I did work hard before asking, specialy before asking on r-devel...

Christophe





Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre

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


Re: [Rd] callCC in 2.7.0

2008-04-01 Thread f.jamitzky

callcc is similar to the yield keyword in python and c#
it lets you define e.g. a generator of lists of numbers.




Gabor Grothendieck wrote:
 
 Would anyone like to explain if callCC in R 2.7.0 gives
 anything that on.exit does not already provide?
 
 It seems that the exit condition once defined cannot
 be added to overridden whereas with on.exit multiple
 on.exit's add additional on.exits rather than being ignored.
 
 Is this important?
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel
 
 

-- 
View this message in context: 
http://www.nabble.com/callCC-in-2.7.0-tp16382578p16395614.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


Re: [Rd] (PR#11054) Writing R Extensions: bad example with CAR

2008-04-01 Thread anders
Prof Brian Ripley wrote:
 I didn't say 'USE_RINTERNALS is not needed' for your code: I said it was 
 not used for the code that was run.

I see. My original point was that the text of the Writing R extension 
manual advises against using 'USE_RINTERNALS' but then gives an example 
that only works when this macro is defined, without even pointing out 
this requirement. I merely wanted to suggest adding a little note to the 
manual at this point to make the matter easier for the reader.

Best regards
   Simon Anders

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


Re: [Rd] tests Rin and Rout

2008-04-01 Thread cgenolin
 hmm, I see 219 out 1378 CRAN packages having a 'tests'
 subdirectory, so it seems you have been a bit unlucky. ;-)



 How unlucky exactly?


  fisher.test(matrix(c(0,20,219,1159),2,2))


Hey, no, I desagree ! I random 10, the 10 first I take the ten first 
package. So this in not random.
May be the people that chose a name package starting with 'a' does not 
like using 'tests'...

So we have to do fisher.test(matrix(c(0,10,219,1159),2,2))


Fisher's Exact Test for Count Data

data:  matrix(c(0, 10, 219, 1159), 2, 2) p-value = 0.3783
alternative hypothesis: true odds ratio is not equal to 1 95 percent 
confidence interval:
0.00 2.380931 sample estimates:
odds ratio

I am not *that* unlucky

Christophe


Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre

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


Re: [Rd] (PR#11054) Writing R Extensions: bad example with CAR

2008-04-01 Thread anders
Dear Prof Ripley,

Prof Brian Ripley wrote:
 But it is not taken 'verbatim from src/main/print.c' (at least not in 
 that version of R), and the code is not run with USE_RINTERNALS defined 
 when write-barrier checking is enabled.
 
 The example has been updated to match the current code in 2.7.0 alpha.

I just assumed that it is copied verbatim without checking because it 
says so in the sentence above the code (As a more comprehensive example 
of constructing an R call in C code and evaluating, consider the 
following fragment of printAttributes in src/main/print.c.)

I don't understand, however, what you mean by stating that 
USE_RINTERNALS is not needed (and I have to admit that I have no 
knowledge of this 'write-barrier checking' mechanism.)

May I ask you to have a look at the following code snippet?

--8-- file foo.c ---
#import R.h
#import Rinternals.h

int main() {
SEXP a, b;
// ...
CAR(a) = b;
}
--8---

If I compile this with gcc -I path to R 2.6.2 foo.c, I get the error 
invalid lvalue in assignment, while it compiles without error if I 
specify the compiler option -DUSE_RINTERNALS.

Looking at the output of the preprocessor output reveals that without 
USE_RINTERNALS, the line CAR(a)=b stays as it is, i.e. presents the 
compiler with a function call as l-value, while with USE-RINTERNALS, it 
gets macro-expanded to ((a)-u.listsxp.carval) = b, which is now a 
valid expression.

 From this observation, I assumed that CAR is implemented as a function 
usually and as a macro only when USE_RINTERNALS is defined. Further, I 
assumed that the proper way for extensions to set car values is to write 
SETCAR(a,b), while R internal code, compiled with USE_RINTERNALS, may 
use CAR(a)=b, which expands to the more efficient macro.

Now, you say that this should have nothing to do with R_USEINTERNALS, 
and that the code snippet in the manual should compile without it as well.

This leaves me confused. Should the code in the manual really compile 
without setting any compiler options? If so, what obvious point am I 
overlooking?

Best regards
   Simon Anders




+---
| Dr. Simon Anders, Dipl. Phys.
| European Bioinformatics Institute, Hinxton, Cambridgeshire, UK
| office phone +44-1223-494478, mobile phone +44-7505-841692
| preferred (permanent) e-mail: [EMAIL PROTECTED]

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


Re: [Rd] callCC in 2.7.0

2008-04-01 Thread Luke Tierney
No.  First class continuations of the kind provided in scheme can be
used as a means to implement generators, but downward-only
continuations as currently provided in R are not sufficient for that.
This version is intended only as a non-local exit mechanism.

Best,

luke

On Mon, 31 Mar 2008, f.jamitzky wrote:


 callcc is similar to the yield keyword in python and c#
 it lets you define e.g. a generator of lists of numbers.




 Gabor Grothendieck wrote:

 Would anyone like to explain if callCC in R 2.7.0 gives
 anything that on.exit does not already provide?

 It seems that the exit condition once defined cannot
 be added to overridden whereas with on.exit multiple
 on.exit's add additional on.exits rather than being ignored.

 Is this important?

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





-- 
Luke Tierney
Chair, 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:  [EMAIL PROTECTED]
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] callCC in 2.7.0

2008-04-01 Thread Gabor Grothendieck
Can I suggest some clarification of the help page for callCC
plainly stating that it is intended to exit from a deeply nested
set of calls.

On a casual reading I thought the exact same thing as f.jamitsky.

On Tue, Apr 1, 2008 at 6:32 AM, Luke Tierney [EMAIL PROTECTED] wrote:
 No.  First class continuations of the kind provided in scheme can be
 used as a means to implement generators, but downward-only
 continuations as currently provided in R are not sufficient for that.
 This version is intended only as a non-local exit mechanism.

 Best,

 luke

 On Mon, 31 Mar 2008, f.jamitzky wrote:

 
  callcc is similar to the yield keyword in python and c#
  it lets you define e.g. a generator of lists of numbers.
 
 
 
 
  Gabor Grothendieck wrote:
 
  Would anyone like to explain if callCC in R 2.7.0 gives
  anything that on.exit does not already provide?
 
  It seems that the exit condition once defined cannot
  be added to overridden whereas with on.exit multiple
  on.exit's add additional on.exits rather than being ignored.
 
  Is this important?
 
  __
  R-devel@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-devel
 
 
 
 

 --
 Luke Tierney
 Chair, 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:  [EMAIL PROTECTED]
 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


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