Re: [Rd] example package for devel newcomers

From: Daniel Fuka <>
Date: Tue, 02 Aug 2011 10:11:12 -0400

Howdy again Alexandre,

This sounds interesting and valuable, though might be touching some areas of R that makes me think others should chime in. I have a history of encouraging behavior that is sometimes not supported by the general public. First search does not find a project currently trying to accomplish what you are trying to do, though someone else might know of a similar project.

Now that I have absolved myself of responsibility {: -) . I think this would be kind of kewl/useful. But, I wonder if it might actually be easier to embed one of the well tested and secured mini-apache web servers into R, which would accomplish much of what you want to do, and I think remove several of the questions you have. It does destroy the "any WCMS" desire you have in a), but I think that it accomplishes b,c,d,f, with the ability to develop out e as you interface the 2. It also might be an easier first package type project, which will get you used to the development environment, and it can support all OS's out of the box.

I played with this morning, and think you might be able to frame a simple package, and do not see any major issues in porting/wrapper'ing it yet in the first 15 minutes of playing with it.

Could others please chime in and bail me out or shoot me down, which ever is best?


On Tue, Aug 2, 2011 at 2:01 AM, Alexandre Aguiar <> wrote:
> Em Segunda 01 Agosto 2011, vocÍ escreveu:
>> Is there a preferred language you would like to use in your package
>> development? I randomly downloaded packages until I found some that
>> helped me along my way, and might be able to help you pick one. If you
>> are just looking at building a package of R functions and data you
>> have developed, possibly the following example will get you started
>> till you feel comfortable with the "Writing R Extensions"
>> documentation (
> Dan, your message is cool. Well, here is what my project is about: it is a
> package to embed php into R. Named Rphp for now. It is mostly done from
> scratch. I have loved R-exts.pdf. Great stuff.
> Why embed php into R? My primary purpose is to use web content management
> systems (WCMS) ready and extensively tested code from R cgi scripts.
> Someone more experienced with php might think of other uses. My approach
> is RAD(ical) and innovative (IMextremelyHO :-D) because:
> a) *any* php based WCMS can be used from R code with no php or html
> coding;
> b) output fully compliant with the website appearance;
> c) WCMS automatic upgrades and interfaces changes (skins or themes) will
> be so unlikey to cause need for maintenance in R cgi scripts;
> d) R cgi scripts will not demand changes in php code;
> e) the builtin php session support obviates the need for any special
> session coding by R (likely non-web) programmers;
> f) potential for improved analysis of web databases and even of systems
> surveillance tasks.
> During my explorations of the R interface for extensions and the time
> spent in this tiny project, some questions emerged.
> 1. my code uses no recursion but I do not really know what is inside php
> code. Stack size could be a concern. Has any of you there ever needed to
> allocate a new stack for a package? Is it better to wait for complaints
> (if anyone ever would like to try this package...)?
> 2. can R_registerRoutines be called more than once within the same library
> (the same DllInfo data) so that it can reconfigure itself on the fly?
> 3. Is it safe (I guess it is) to "re-export" a function pointer retrieved
> with R_GetCCallable?
> 4. when loading a second library (in this case is it better to
> put it in the package library directory and load it using the 'char
> *path' member of DllInfo? Using a second library has implications:
> a) a given R setup can be limited to the user space without root access;
> b) in the case of desktops where someone might use Rphp, most systems do
> not have installed by default and installing it frequently
> means to install apache and all (many) related packages;
> c) many sysadmins do not have root access but can compile their own php
> version;
> d) building the may not be an easy task for many.
> 5. Similar to 3, is it safe to "export" functions of the second library?
> will not be registered to R and has some interesting functions
> that can be "exported" directly or as pointers within Rphp library. A
> stub function can be used.
> 6. related to 4, with the many machine architectures and operating systems
> around I think it is neither desirable nor feasible to distribute
> precompiled versions; the package itself can download (wget
> and curl are everywhere) and compile php. Compiling php is not a lengthy
> task (6m12.9s in my quadcore desktop) but is a lot tricky and demands
> several development packages not installed by default in desktop systems.
> Their installations would require root access. What is the suggested
> approach to deploy
> 7. I do not know how to produce a version for windows if requested. I have
> only an old MSC++ 97 and lcc (current) and have xp in a virtual box. This
> concern includes php. Can I get help regarding windows in this list? It
> might mean actual work: adapting code, compiling, packaging, etc. Not
> sure what is needed.
> 8. system safety does not seem a concern regarding this use of php, but...
> Any suggestions?
> I guess some manual steps will be necessary because of potential security
> breaches related to the use of a second library. Patching php to produce
> a special build to be used as the package library would not be a trivial
> task and would demand updates at every new php version. Something I can't
> assure I can do. And would have to distribute the whole php source code:
> still have to study php licensing scheme.
> BTW, I copied Rdynpriv.h by hand to my include path to get access
> to 'struct _DllInfo' definition. The R install process did not copy this
> file. Am I doing something wrong here?
> Sorry for the lengthy message. Thanx for your help.
> --
> Alexandre
> --
> Alexandre Santos Aguiar, MD, SCT
> ______________________________________________
> mailing list
> mailing list Received on Tue 02 Aug 2011 - 14:13:48 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 02 Aug 2011 - 16:10:13 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive