[Rd] Runnable R packages

David Lindelof ||nde|o| @end|ng |rom |eee@org
Fri Feb 1 09:44:13 CET 2019


@Barry I'm not sure your proposal would work, since `R CMD INSTALL` won't
install a package's dependencies. Indeed it will fail with an error unless
all the dependencies are met before calling it.

Speaking of which, why doesn't R CMD INSTALL install a package's
dependencies? Would it make sense to submit this as a desirable feature?

Cheers,

David

On Thu, Jan 31, 2019 at 4:38 PM Barry Rowlingson <
b.rowlingson using lancaster.ac.uk> wrote:

>
>
> On Thu, Jan 31, 2019 at 3:14 PM David Lindelof <lindelof using ieee.org> wrote:
>
>>
>> In summary, I'm convinced R would benefit from something similar to Java's
>> `Main-Class` header or Python's `__main__()` function. A new R CMD command
>> would take a package, install its dependencies, and run its "main"
>> function.
>
>
>
> I just created and built a very boilerplate R package called "runme". I
> can install its dependencies and run its "main" function with:
>
>  $ R CMD INSTALL runme_0.0.0.9000.tar.gz
>  $ R -e 'runme::main()'
>
> No new R CMDs needed. Now my choice of "main" is arbitrary, whereas with
> python and java and C the entrypoint is more tightly specified (__name__ ==
> "__main__" in python, int main(..) in C and so on). But I don't think
> that's much of a problem.
>
> Does that not satisfy your requirements close enough? If you want it in
> one line then:
>
> R CMD INSTALL runme_0.0.0.9000.tar.gz && R -e 'runme::main()'
>
> will do the second if the first succeeds (Unix shells).
>
> You could write a script for $RHOME/bin/RUN which would be a two-liner and
> that could mandate the use of "main" as an entry point. But good luck
> getting anything into base R.
>
> Barry
>
>
>
>
>> If we have this machinery available, we could even consider
>> reaching out to Spark (and other tech stacks) developers and make it
>> easier
>> to develop R applications for those platforms.
>>
>>
>
>

	[[alternative HTML version deleted]]



More information about the R-devel mailing list