No subject

Jonathan Myles jonathan.myles at mrc-bsu.cam.ac.uk
Thu May 27 20:46:27 CEST 1999


(I dithered a bit about whether this belongs on r-help
 (as part of it is a general R question) or r-devel
 (as it's a question relating to putting stuff on
 CRAN) but decided it might be of general enough interest
 to go on the former )


I am currently preparing an R library to estimate 
approximate posterior distributions for parameters in
Generalised Linear Mixed Models by Gibbs Sampling
which includes a lot of dynamically loaded C code.
I'm pleased with the way in which it is working and am 
now hammering out some documentation, but closer consideration
of some R documentation has led me to worry that my code
a) may not achieve certain standards of R and C programming
and b) may not work on all systems. (I'm using 0.64.1
on a UNIX system)

My worries are

a) That I've used calloc rather than S_alloc throughout.

b) That I've used the following technique: I've
   calls to different C programs held together in a single
   file which looks like:

      GLM g;  /* information about the model */
      OUTPUT o; /* information about the output *

      f1(g){ ....... }
      f2(g,o) { ......}



    (GLM and OUTPUT are 
    typedefs defined in a .h file)


    with an R function that looks like :
    {
      <R statements>

      .C("f1",.....)

      <R statements>
 
      .C("f2",.....)       

       <R statements>

       ...

      }
 
and I rely on the fact that "g" and "o" remain the same between the successive
calls (there's a C call at the end to free up all the memory).  is this:

      1) bad,
      2) so bad (-;) that the R archive wouldn't really be interested in code
         that worked in this way?

I *think* I can do it without using this technique, but it will need a lot
of re-programming.  One way round it in S v5 uses the new .Call() 
function---is anything similar on the agenda for future versions of R?

On another note, where in the library structure would be a good     
place to put a LaTeX document describing the function and showing
some examples?

Thanks,

Jonathan

-- 
Dr. Jonathan Myles         e-mail:jonathan.myles at mrc-bsu.cam.ac.uk
MRC Biostatistics Unit     Tel. 01223 330371
Institute of Public Health FAX  01223 330388
University Forvie Site
Robinson Way
CAMBRIDGE
CB2 2SR                   
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list