Would you care to share how your package installs its own dependencies? I assume this is done during the call to `main()`? (Last time I checked, R CMD INSTALL would not install a package's dependencies...) On Thu, Jan 31, 2019 at 4:38 PM Barry Rowlingson < b.rowlingson at lancaster.ac.uk> wrote:> > > On Thu, Jan 31, 2019 at 3:14 PM David Lindelof <lindelof at 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]]
To download a package with all its dependencies and install it, use the
install.packages() functions instead of 'R CMD INSTALL'. E.g., in bash:
mkdir /tmp/libJunk
env R_LIBS_SITE=libJunk R --quiet -e 'if
(!requireNamespace("purrr",quietly=TRUE))
install.packages("purrr")'
For corporate "production use" you probably want to set up your own
repository containing
fixed versions of packages instead of using CRAN. Then edd
repos="..." to
the install.packages()
call. Of course you can put this into a package and somehow deal with the
bootstrapping issue.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Thu, Jan 31, 2019 at 8:04 AM David Lindelof <lindelof at ieee.org>
wrote:
> Would you care to share how your package installs its own dependencies? I
> assume this is done during the call to `main()`? (Last time I checked, R
> CMD INSTALL would not install a package's dependencies...)
>
>
> On Thu, Jan 31, 2019 at 4:38 PM Barry Rowlingson <
> b.rowlingson at lancaster.ac.uk> wrote:
>
> >
> >
> > On Thu, Jan 31, 2019 at 3:14 PM David Lindelof <lindelof at
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]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
[[alternative HTML version deleted]]
On 1 February 2019 at 13:31, William Dunlap via R-devel wrote:
| To download a package with all its dependencies and install it, use the
| install.packages() functions instead of 'R CMD INSTALL'. E.g., in
bash:
|
| mkdir /tmp/libJunk
| env R_LIBS_SITE=libJunk R --quiet -e 'if
| (!requireNamespace("purrr",quietly=TRUE))
install.packages("purrr")'
Or one could use 'littler' and install some of its examples in the $PATH
path
(which I tend to do via softlinks to get updates easily).
Then it is simply
$ install.r purrr
and there is also install2.r with docopt goodness and more options.
These have been my preferred tools for many years at home and work, and they
found their way through Rocker dockerfiles as well as install2.r was started
by Carl for added features.
| For corporate "production use" you probably want to set up your own
| repository containing
| fixed versions of packages instead of using CRAN. Then edd
repos="..." to
| the install.packages()
| call. Of course you can put this into a package and somehow deal with the
| bootstrapping issue.
Absolutely. But what repo to source packages from is somewhat orthogonal to
how to install from there. Also, thanks to Gergely, repos is now an argument
to install2.r
Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org